I'm trying to add a video intro to my main video. I have the following:

ffmpeg \
    -i main-video.mp4 -i intro.avi \
    -filter_complex " \
        [0:v]setpts=PTS-STARTPTS, scale=2550x1080[top]; \
        [1:v]setpts=PTS-STARTPTS, scale=1920x1080, \
             format=yuva420p,colorchannelmixer=aa=1[bottom]; \
        [top][bottom]overlay=shortest=1" \
    -acodec libvo_aacenc -vcodec libx264 out.mp4

main-video.mp4 -> 2250 x 1080

intro.avi -> 1920x1080

I have 2 problems with the above;

  1. After the intro overlay has finished the main video pauses, however the main video audio continues for the correct duration of the main video (with a paused video frame the entire time)

  2. The intro video overlay is left aligned, ideally I'd like it to be centered, either through auto calculations based on the 2 resolutions, or by nudging the x/y manually

1 Answer 1


The overlay filter is set to end with the shortest input, which here is the intro. So, the video output stops generating after that, so a typical video player holds the visual on the last frame.

Also, if your intro already has transparency, you can skip the format and ccm filters. In the command you took them from, the inputs did not have transparency in the source.

(Unless you are resizing the videos, you can skip the scale as well.)


ffmpeg \
    -i main-video.mp4 -i intro.avi \
    -filter_complex " \
        [0:v]setpts=PTS-STARTPTS,scale=2550x1080[top]; \
        [1:v]setpts=PTS-STARTPTS,scale=1920x1080[bottom]; \
        [top][bottom]overlay=x=(W-w)/2:eof_action=pass" \
    -acodec aac -vcodec libx264 out.mp4

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.