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

Steven Kan steven at kan.org
Fri Mar 5 21:33:10 EET 2021


>>> 
>>> 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


I brute-forced it by using tpad to pad the first video by itself, and then I used hstack to glue them together. Not the most efficient way of doing things, and I think that induces 2 generations of transcoding, so ideally I’d like to know how to do it properly in the future. But here’s the end result:

https://www.youtube.com/watch?v=ByUHKRtA6Zo&list=PLm4gRKwvTste1lnrHLIHWMZ1WpJSA1vb9&index=2



More information about the ffmpeg-user mailing list