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

Peter White peter.white at posteo.net
Thu Mar 4 23:56:02 EET 2021


On 04.03.21 21:36, Steven Kan wrote:
> I have captured some nice footage of 3 coyotes traipsing through my yard, from two IP cameras facing opposite directions. Recording was initiated by in-camera motion triggers, so the recordings start about 50 seconds apart, as you can tell from the burned-in timestamps at the start of each video at 01:10:17 and 01:11:07, respectively:
> 
> https://www.youtube.com/watch?v=lP5Kpg_vTEE
>   <https://www.youtube.com/watch?v=jvXoUhKuC5c> <https://www.youtube.com/watch?v=jvXoUhKuC5c>https://www.youtube.com/watch?v=jvXoUhKuC5c
> 
> 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

Maybe try a different approach. There is a color source in ffmpeg which
creates frames of arbitrary dimensions and color. Basically, you create
a black video that is as long as the time offset of the TrailDown video
and append the latter to that one. And afterwards you can do the
side-by-side thing.

Something like this:
ffmpeg -f lavfi -i ffmpeg -f lavfi -i 
color=size=960x720:rate=60:color=black -c libvpx-vp9 -t 50 offset.ts
ffmpeg -i TrailDown.mp4 -c copy TrailDown.ts
cat offset.ts TrailDown.ts > TrailDown_offset.ts

And then use TrailDown_offset.ts in your filter chain. I believe using
mpegts as container is necessary for concatenation but am not sure. But
the codec and video parameters (frame rate, dimensions) must match.
Consider this a (very rough) proof of concept.


Peter


More information about the ffmpeg-user mailing list