[FFmpeg-user] hstack with one video offset in time?

Steven Kan steven at kan.org
Sat Mar 6 21:22:19 EET 2021

> On Mar 5, 2021, at 2:00 PM, Michael Koch <astroelectronic at t-online.de> wrote:
> Am 05.03.2021 um 20:33 schrieb Steven Kan:
>>>>> I’d like to assemble these videos, side-by-side, but synced in time, which
>>>>> means the TrailDown video needs to start 50 seconds after the TrailUp
>>>>> video. The TrailDown side can be black/blank, or it can be stuck on the
>>>>> first frame of its video while the right side plays for the first 50
>>>>> seconds; it doesn’t matter to me.
>>>>> I’ve tried all of the following:
>>>>> -itsoffset 50 -i TrailDown.mp4 -i TrailUp.mp4
>>>>> -itsoffset 50 -i TrailDown.mp4 -itsoffset 0 -i TrailUp.mp4
>>>>> -i TrailDown.mp4 -itsoffset -50 -i TrailUp.mp4
>>>> see tpad filter, need recent version.
>>> Thanks! I have figured out the syntax to pad a single video with tpad, e.g.:
>>> ffmpeg -i /Users/steven/Downloads/Record/DownLoad/TrailDown_ch1_20210304010952_20210304011838.mp4 -filter_complex "tpad=start_duration=50" tPadOut.mp4
>>> but I’m having trouble with the syntax to delay only one of two videos in an hstack filter:
>>> ffmpeg -i /Users/steven/Downloads/Record/DownLoad/TrailDown_ch1_20210304010952_20210304011838.mp4 -i /Users/steven/Downloads/Record/DownLoad/TrailUp_ch1_20210304010838_20210304011506.mp4 -filter_complex "tpad=start_duration=50[v0];hstack=inputs=2” Coyote2Up.mp4
> try this command line:
> ffmpeg -i input1.mp4 -i input2.mp4 -filter_complex "[0]tpad=start_duration=50[a];[a][1]hstack” out.mp4

Thank you! That worked perfectly, and now that I understand the syntax, this works as well (to pad the end of the second track by 15 sec:

ffmpeg -i Input1.mp4 -i Input2 -filter_complex "[0]tpad=start_duration=50[a];[1]tpad=stop_duration=15[b];[a][b]hstack" Out.mp4

More information about the ffmpeg-user mailing list