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

Steven Kan steven at kan.org
Fri Mar 5 05:59:43 EET 2021


> On Mar 4, 2021, at 1:57 PM, Paul B Mahol <onemda at gmail.com> wrote:
> 
> On Thu, Mar 4, 2021 at 9:36 PM Steven Kan <steven at kan.org> 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
>> 
> 
> 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
ffmpeg version N-100466-g29cef1bcd6-tessus  https://evermeet.cx/ffmpeg/  Copyright (c) 2000-2020 the FFmpeg developers
  built with Apple clang version 11.0.0 (clang-1100.0.33.17)
  configuration: --cc=/usr/bin/clang --prefix=/opt/ffmpeg --extra-version=tessus --enable-avisynth --enable-fontconfig --enable-gpl --enable-libaom --enable-libass --enable-libbluray --enable-libdav1d --enable-libfreetype --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libmysofa --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvmaf --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-version3 --pkg-config-flags=--static --disable-ffplay
  libavutil      56. 62.100 / 56. 62.100
  libavcodec     58.115.102 / 58.115.102
  libavformat    58. 65.100 / 58. 65.100
  libavdevice    58. 11.103 / 58. 11.103
  libavfilter     7. 94.100 /  7. 94.100
  libswscale      5.  8.100 /  5.  8.100
  libswresample   3.  8.100 /  3.  8.100
  libpostproc    55.  8.100 / 55.  8.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/Users/steven/Downloads/Record/DownLoad/TrailDown_ch1_20210304010952_20210304011838.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    creation_time   : 2021-03-04T18:50:57.000000Z
  Duration: 00:01:09.05, start: 0.000000, bitrate: 6353 kb/s
    Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 2592x1944, 6351 kb/s, 20 fps, 20 tbr, 1k tbn, 2k tbc (default)
    Metadata:
      creation_time   : 2021-03-04T18:50:57.000000Z
      handler_name    : VideoHandler
      vendor_id       : [0][0][0][0]
Input #1, mov,mp4,m4a,3gp,3g2,mj2, from '/Users/steven/Downloads/Record/DownLoad/TrailUp_ch1_20210304010838_20210304011506.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    creation_time   : 2021-03-04T18:52:03.000000Z
  Duration: 00:01:43.90, start: 0.000000, bitrate: 6319 kb/s
    Stream #1:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 2592x1944, 6317 kb/s, 20 fps, 20 tbr, 1k tbn, 2k tbc (default)
    Metadata:
      creation_time   : 2021-03-04T18:52:03.000000Z
      handler_name    : VideoHandler
      vendor_id       : [0][0][0][0]
Cannot find a matching stream for unlabeled input pad 1 on filter Parsed_hstack_1



More information about the ffmpeg-user mailing list