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

Steven Kan steven at kan.org
Thu Mar 4 22:36:31 EET 2021


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

and they all result in both halves of the video doing nothing until they both start together, at a burned-in timestamp of 01:11:07. So I apparently have the syntax slightly wrong, or I’m using the wrong flag. Thanks!

ffmpeg -i /Users/steven/Downloads/Record/DownLoad/TrailDown_ch1_20210304010952_20210304011838.mp4 -itsoffset -50 -i /Users/steven/Downloads/Record/DownLoad/TrailUp_ch1_20210304010838_20210304011506.mp4 -filter_complex 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]
File 'Coyote2Up.mp4' already exists. Overwrite? [y/N] y
Stream mapping:
  Stream #0:0 (h264) -> hstack:input0
  Stream #1:0 (h264) -> hstack:input1
  hstack -> Stream #0:0 (libx264)
Press [q] to stop, [?] for help
[libx264 @ 0x7fcf14806400] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 0x7fcf14806400] profile High, level 6.0, 4:2:0, 8-bit
[libx264 @ 0x7fcf14806400] 264 - core 161 r3027 4121277 - H.264/MPEG-4 AVC codec - Copyleft 2003-2020 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=20 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'Coyote2Up.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.65.100
    Stream #0:0: Video: h264 (avc1 / 0x31637661), yuv420p(progressive), 5184x1944, q=2-31, 20 fps, 10240 tbn (default)
    Metadata:
      encoder         : Lavc58.115.102 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
frame= 1381 fps=5.9 q=-1.0 Lsize=  131831kB time=00:01:08.90 bitrate=15674.3kbits/s speed=0.294x    
video:131812kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.014291%
[libx264 @ 0x7fcf14806400] frame I:6     Avg QP:17.32  size:2250843
[libx264 @ 0x7fcf14806400] frame P:458   Avg QP:19.74  size:235443
[libx264 @ 0x7fcf14806400] frame B:917   Avg QP:28.78  size: 14871
[libx264 @ 0x7fcf14806400] consecutive B-frames:  3.8% 19.4% 11.1% 65.7%
[libx264 @ 0x7fcf14806400] mb I  I16..4:  3.0% 19.9% 77.1%
[libx264 @ 0x7fcf14806400] mb P  I16..4:  0.2%  0.7%  0.7%  P16..4: 37.1%  4.7%  4.9%  0.0%  0.0%    skip:51.7%
[libx264 @ 0x7fcf14806400] mb B  I16..4:  0.0%  0.1%  0.0%  B16..8: 26.8%  1.4%  0.5%  direct: 0.3%  skip:70.8%  L0:42.8% L1:55.8% BI: 1.3%
[libx264 @ 0x7fcf14806400] 8x8 transform intra:33.8% inter:16.1%
[libx264 @ 0x7fcf14806400] coded y,uvDC,uvAC intra: 91.5% 0.0% 0.0% inter: 7.8% 0.0% 0.0%
[libx264 @ 0x7fcf14806400] i16 v,h,dc,p: 26% 17% 30% 27%
[libx264 @ 0x7fcf14806400] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 18% 15% 21%  6%  7%  8%  7%  8%  9%
[libx264 @ 0x7fcf14806400] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 20% 15% 13%  7%  9% 10%  9%  8%  9%
[libx264 @ 0x7fcf14806400] i8c dc,h,v,p: 100%  0%  0%  0%
[libx264 @ 0x7fcf14806400] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0x7fcf14806400] ref P L0: 83.8%  4.9% 10.1%  1.2%
[libx264 @ 0x7fcf14806400] ref B L0: 93.1%  6.8%  0.2%
[libx264 @ 0x7fcf14806400] ref B L1: 95.3%  4.7%
[libx264 @ 0x7fcf14806400] kb/s:15637.92


-- 
Steven "Rocket Man" Kan                          #```````
mailto:steven at kan.org                            #  ```````
http://www.kan.org                               #    ```````
aim://stevenkan@me.com                           #      ```````
                                                 #        ```````
                                    ~       ~      . \_ at _/  ```````
                            ^_@         o            . V      ```````
                          `-'  -         \_ at _   ~      .       ######
                                           V \       ~   .     ######
                                    ~                      .   #H2O##
                                ~                            . #POLO#
Blood, sweat, and chlorine                          ~    ~     ######



More information about the ffmpeg-user mailing list