[FFmpeg-user] hstack a video with a delayed version of itself

Michael Koch astroelectronic at t-online.de
Wed Aug 14 15:36:08 EEST 2019


Hello all,

I want to hstack a video with a delayed version of itself.

First test:

ffmpeg -f lavfi -i testsrc2=size=600x400:duration=10 -y test1.mp4

This produces a video of 10 seconds length. The clock is running from 0 
to 10, as expected.


Second test:

ffmpeg -f lavfi -i testsrc2=size=600x400:duration=10 -vf trim=start=4 -y 
test2.mp4

This produces a video of 6 seconds length. The clock is running from 4 
to 10, as expected.


Third test:

ffmpeg -f lavfi -i testsrc2=size=600x400:duration=10 -filter_complex 
split[1][2];[2]trim=start=4,setpts=PTS-4[3];[1][3]hstack=shortest=1 -y 
test3.mp4

This produces a video of 6 seconds length. But both clocks are running 
synchronously from 4 to 10. I would have expected that one clock runs 
from 0 to 6 and the other from 4 to 10.

The console output for the third test is copied below.

Michael



F:\Perseiden_2019>c://ffmpeg/ffmpeg -f lavfi -i 
testsrc2=size=600x400:duration=1
0 -filter_complex 
split[1][2];[2]trim=start=4,setpts=PTS-4[3];[1][3]hstack=short
est=1 -y test3.mp4
ffmpeg version N-94455-g01994c93db Copyright (c) 2000-2019 the FFmpeg 
developers

   built with gcc 9.1.1 (GCC) 20190716
   configuration: --enable-gpl --enable-version3 --enable-sdl2 
--enable-fontconfi
g --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d 
--enable-libb
luray --enable-libfreetype --enable-libmp3lame 
--enable-libopencore-amrnb --enab
le-libopencore-amrwb --enable-libopenjpeg --enable-libopus 
--enable-libshine --e
nable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame 
--enable
-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 
--enable-libx265 -
-enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib 
--enable-gmp --enab
le-libvidstab --enable-libvorbis --enable-libvo-amrwbenc 
--enable-libmysofa --en
able-libspeex --enable-libxvid --enable-libaom --enable-libmfx 
--enable-amf --en
able-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc 
--enable-nvdec --e
nable-dxva2 --enable-avisynth --enable-libopenmpt
   libavutil      56. 33.100 / 56. 33.100
   libavcodec     58. 55.100 / 58. 55.100
   libavformat    58. 30.100 / 58. 30.100
   libavdevice    58.  9.100 / 58.  9.100
   libavfilter     7. 58.100 /  7. 58.100
   libswscale      5.  6.100 /  5.  6.100
   libswresample   3.  6.100 /  3.  6.100
   libpostproc    55.  6.100 / 55.  6.100
Input #0, lavfi, from 'testsrc2=size=600x400:duration=10':
   Duration: N/A, start: 0.000000, bitrate: N/A
     Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 600x400 
[SAR 1:1
DAR 3:2], 25 tbr, 25 tbn, 25 tbc
Stream mapping:
   Stream #0:0 (rawvideo) -> split
   hstack -> Stream #0:0 (libx264)
Press [q] to stop, [?] for help
[libx264 @ 000000000056afc0] using SAR=1/1
[libx264 @ 000000000056afc0] using cpu capabilities: MMX2 SSE2Fast SSSE3 
SSE4.2
AVX FMA3 BMI2 AVX2
[libx264 @ 000000000056afc0] profile High, level 3.1, 4:2:0, 8-bit
[libx264 @ 000000000056afc0] 264 - core 158 r2984 3759fcb - H.264/MPEG-4 
AVC cod
ec - Copyleft 2003-2019 - http://www.videolan.org/x264.html - options: 
cabac=1 r
ef=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_pski
p=1 chroma_qp_offset=-2 threads=6 lookahead_threads=1 sliced_threads=0 
nr=0 deci
mate=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=2
5 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 
qcomp=0.6
0 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'test3.mp4':
   Metadata:
     encoder         : Lavf58.30.100
     Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 
1200x400 [S
AR 1:1 DAR 3:1], q=-1--1, 25 fps, 12800 tbn, 25 tbc
     Metadata:
       encoder         : Lavc58.55.100 libx264
     Side data:
       cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
frame=   71 fps=0.0 q=28.0 size=       0kB time=00:00:04.56 bitrate=   
0.1kbits/
frame=  136 fps=133 q=28.0 size=     512kB time=00:00:07.16 bitrate= 
585.8kbits/
[Parsed_testsrc2_0 @ 00000000004f48c0] EOF timestamp not reliable
frame=  150 fps=104 q=-1.0 Lsize=    1103kB time=00:00:09.72 bitrate= 
930.0kbits
/s speed=6.77x
video:1101kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB 
muxing
overhead: 0.232055%
[libx264 @ 000000000056afc0] frame I:1     Avg QP:16.81  size: 20849
[libx264 @ 000000000056afc0] frame P:48    Avg QP:25.84  size: 10446
[libx264 @ 000000000056afc0] frame B:101   Avg QP:30.53  size:  5984
[libx264 @ 000000000056afc0] consecutive B-frames:  1.3% 21.3% 16.0% 61.3%
[libx264 @ 000000000056afc0] mb I  I16..4: 50.9% 33.1% 16.1%
[libx264 @ 000000000056afc0] mb P  I16..4:  2.0%  5.7%  2.0% P16..4:  
9.9%  5.2
%  3.6%  0.0%  0.0%    skip:71.6%
[libx264 @ 000000000056afc0] mb B  I16..4:  0.2%  0.2%  0.1% B16..8: 
15.1%  3.9
%  1.3%  direct: 2.0%  skip:77.3%  L0:48.8% L1:43.6% BI: 7.6%
[libx264 @ 000000000056afc0] 8x8 transform intra:52.8% inter:34.4%
[libx264 @ 000000000056afc0] coded y,uvDC,uvAC intra: 14.2% 27.5% 26.1% 
inter: 4
.5% 9.7% 8.7%
[libx264 @ 000000000056afc0] i16 v,h,dc,p: 77% 21%  2%  0%
[libx264 @ 000000000056afc0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu:  8%  9% 82%  
0%  0%
  0%  0%  0%  1%
[libx264 @ 000000000056afc0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 33% 22% 37%  
1%  1%
  1%  1%  1%  3%
[libx264 @ 000000000056afc0] i8c dc,h,v,p: 61% 16% 20%  3%
[libx264 @ 000000000056afc0] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 000000000056afc0] ref P L0: 47.2%  7.1% 26.8% 19.0%
[libx264 @ 000000000056afc0] ref B L0: 77.1% 18.7%  4.2%
[libx264 @ 000000000056afc0] ref B L1: 94.9%  5.1%
[libx264 @ 000000000056afc0] kb/s:1502.18



More information about the ffmpeg-user mailing list