Use -itsoffset
just before the overlayed input with the same ammount of seconds you are using in the start of the filter (3 in your case)
This is maintaining the fade out
filter you had, but that filter does not produce any visible results:
ffmpeg -y -i big_buck_bunny.mp4 -itsoffset 3 -i alpha.mov -filter_complex "[1:v] fade=out:st=30:d=1:alpha=1 [ov]; [0:v][ov] overlay=10:main_h-overlay_h-10:enable=between(t\,3\,5) [v]" -map "[v]" -map 0:a -c:v libx264 -c:a copy out.mp4
This is with 3 inputs (2 overlays and a base) and without that other filter:
ffmpeg -y -i basevideo.mp4 -itsoffset 3 -i overlay1.mp4 -itsoffset 8 -i overlay2.mp4 -filter_complex "[0:v][1:v] overlay=0:0:enable=between(t\,3\,5) [oa]; [oa][2:v] overlay=0:0:enable=between(t\,8\,10) [ob]" -map "[ob]" -map 0:a -c:v libx264 -c:a copy output.mp4
To keep adding overlayed videos:
- add
-itsoffset **X** -i newinput.mp4
after last input file.- Order of input files is important
**X**
is the time the overlay video will start playing (this will not show the overlay, just start internally the play of the video). Adjust it as neccesary (probably matching the value of**X**
in the next step)
- insert another
[**previous_output**][**Y**:v] overlay=0:0:enable=between(t\,**X**\,**Z**) [**new_output**]
after last block.**Y**
is the Yth input file, starting on 0 (in my example basevideo is 0, overlay1 is 1, overlay2 is 2, etc).**X**
is the time the overlay will show up in the output video.**Z**
is the time the overlay will hide in the output video.- Time is counted as for the start of the basevideo, not the lenght of the overlayed video, so do your calculations on duration: if the overlay video is 2 seconds long,
**Z**
will be**X**
+ 2.
- Adjust the
-map "[**XX**]
at the end of the command to match the**new_output**
, or you will be writing to file the previous step!
NOTE audio is grabbed directly from basevideo. The audios from the other sources are ignored and will not play at all.