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

Peter White peter.white at posteo.net
Fri Mar 5 23:53:58 EET 2021


On Fri, Mar 05, 2021 at 11:33:10AM -0800, Steven Kan wrote:
> 
> >>> 
> >>> 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:

You need to map your input files to the appropriate filter pads in a
complex graph. Since I use this kind of filter graph very rarely, I
cannot tell you offhand how to do this properly. The manual section on
this should be a good start though.

Of course, you can always try the approach I suggested in the other
subthread. No transcoding of the original there until you get to the
last stage.


Peter


More information about the ffmpeg-user mailing list