[FFmpeg-user] delay a video in a filter chain
Michael Koch
astroelectronic at t-online.de
Mon Jun 10 13:44:01 EEST 2019
Hi all,
I want to delay a video in a filter chain by 5 seconds, and then combine
it with the original video with hstack. I use the shortest=1 option, so
that the output contains only the duration where both videos overlap:
ffmpeg -f lavfi -i testsrc=duration=10:size=vga:rate=25 -filter_complex
split[a][b];[b]setpts=PTS+5/TB[c];[a][c]hstack=shortest=1 -y out1.mp4
This works as expected. The input length is 10s and the output length is 5s.
However, when I use the same command line with another input video, I
don't get the expected result:
ffmpeg -i 308.mov -filter_complex
split[a][b];[b]setpts=PTS+5/TB[c];[a][c]hstack=shortest=1 -y out2.mp4
The input length is 24.22s and the output length is the same. I would
have expected that the output is 5s shorter than the input. What's wrong
with my command line?
Below are the console outputs for both command lines.
Thanks,
Michael
F:\2019-06-08_Meteore>c://ffmpeg/ffmpeg -f lavfi -i
testsrc=duration=10:size=vga
:rate=25 -filter_complex
split[a][b];[b]setpts=PTS+5/TB[c];[a][c]hstack=shortest
=1 -y out1.mp4
ffmpeg version N-93686-g8019395889 Copyright (c) 2000-2019 the FFmpeg
developers
built with gcc 8.3.1 (GCC) 20190414
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. 26.100 / 56. 26.100
libavcodec 58. 52.100 / 58. 52.100
libavformat 58. 27.103 / 58. 27.103
libavdevice 58. 7.100 / 58. 7.100
libavfilter 7. 50.100 / 7. 50.100
libswscale 5. 4.100 / 5. 4.100
libswresample 3. 4.100 / 3. 4.100
libpostproc 55. 4.100 / 55. 4.100
Input #0, lavfi, from 'testsrc=duration=10:size=vga:rate=25':
Duration: N/A, start: 0.000000, bitrate: N/A
Stream #0:0: Video: rawvideo (RGB[24] / 0x18424752), rgb24, 640x480
[SAR 1:1
DAR 4:3], 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 @ 0000000003603000] using SAR=1/1
[libx264 @ 0000000003603000] using cpu capabilities: MMX2 SSE2Fast SSSE3
SSE4.2
AVX FMA3 BMI2 AVX2
[libx264 @ 0000000003603000] profile High 4:4:4 Predictive, level 3.1,
4:4:4, 8-
bit
[libx264 @ 0000000003603000] 264 - core 157 r2970 5493be8 - 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=4 threads=6 lookahead_threads=1 sliced_threads=0
nr=0 decim
ate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3
b_pyramid=2 b_a
dapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250
keyint_min=25
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 'out1.mp4':
Metadata:
encoder : Lavf58.27.103
Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv444p,
1280x480 [S
AR 1:1 DAR 8:3], q=-1--1, 25 fps, 12800 tbn, 25 tbc
Metadata:
encoder : Lavc58.52.100 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
frame= 57 fps=0.0 q=28.0 size= 0kB time=00:00:05.16 bitrate=
0.1kbits/
frame= 120 fps=117 q=28.0 size= 0kB time=00:00:07.68 bitrate=
0.0kbits/
[Parsed_testsrc_0 @ 0000000000684800] EOF timestamp not reliable
frame= 125 fps=100 q=-1.0 Lsize= 53kB time=00:00:09.88 bitrate=
44.2kbits
/s speed=7.92x
video:51kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB
muxing ov
erhead: 4.524411%
[libx264 @ 0000000003603000] frame I:1 Avg QP:15.02 size: 10182
[libx264 @ 0000000003603000] frame P:31 Avg QP:14.80 size: 893
[libx264 @ 0000000003603000] frame B:93 Avg QP:13.64 size: 147
[libx264 @ 0000000003603000] consecutive B-frames: 0.8% 0.0% 0.0% 99.2%
[libx264 @ 0000000003603000] mb I I16..4: 62.1% 26.5% 11.4%
[libx264 @ 0000000003603000] mb P I16..4: 3.0% 1.3% 0.4% P16..4:
3.2% 3.0
% 0.2% 0.0% 0.0% skip:88.9%
[libx264 @ 0000000003603000] mb B I16..4: 0.1% 0.2% 0.0% B16..8:
2.7% 0.0
% 0.0% direct: 0.0% skip:97.0% L0:48.4% L1:50.3% BI: 1.2%
[libx264 @ 0000000003603000] 8x8 transform intra:31.0% inter:91.2%
[libx264 @ 0000000003603000] coded y,u,v intra: 4.1% 3.6% 3.3% inter:
0.1% 0.1%
0.1%
[libx264 @ 0000000003603000] i16 v,h,dc,p: 80% 12% 1% 8%
[libx264 @ 0000000003603000] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 55% 15% 30%
0% 0%
0% 0% 0% 0%
[libx264 @ 0000000003603000] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 35% 46% 14%
1% 1%
1% 0% 1% 0%
[libx264 @ 0000000003603000] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0000000003603000] ref P L0: 70.5% 4.1% 20.2% 5.1%
[libx264 @ 0000000003603000] ref B L0: 71.3% 26.5% 2.2%
[libx264 @ 0000000003603000] ref B L1: 94.9% 5.1%
[libx264 @ 0000000003603000] kb/s:82.53
F:\2019-06-08_Meteore>c://ffmpeg/ffmpeg -i 308.mov -filter_complex
split[a][b];[
b]setpts=PTS+5/TB[c];[a][c]hstack=shortest=1 -y out2.mp4
ffmpeg version N-93686-g8019395889 Copyright (c) 2000-2019 the FFmpeg
developers
built with gcc 8.3.1 (GCC) 20190414
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. 26.100 / 56. 26.100
libavcodec 58. 52.100 / 58. 52.100
libavformat 58. 27.103 / 58. 27.103
libavdevice 58. 7.100 / 58. 7.100
libavfilter 7. 50.100 / 7. 50.100
libswscale 5. 4.100 / 5. 4.100
libswresample 3. 4.100 / 3. 4.100
libpostproc 55. 4.100 / 55. 4.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '308.mov':
Metadata:
major_brand : qt
minor_version : 512
compatible_brands: qt
encoder : Lavf58.27.103
Duration: 00:00:24.22, start: 0.000000, bitrate: 168 kb/s
Stream #0:0(eng): Video: h264 (High 4:2:2) (avc1 / 0x31637661),
yuv422p10le,
640x480 [SAR 1:1 DAR 4:3], 33 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc
(default)
Metadata:
handler_name : VideoHandler
encoder : Lavc58.52.100 libx264
timecode : 03:54:20:05
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz,
stereo, flt
p, 128 kb/s (default)
Metadata:
handler_name : SoundHandler
Stream #0:2(eng): Data: none (tmcd / 0x64636D74), 0 kb/s
Metadata:
handler_name : VideoHandler
timecode : 03:54:20:05
Stream mapping:
Stream #0:0 (h264) -> split (graph 0)
hstack (graph 0) -> Stream #0:0 (libx264)
Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
[libx264 @ 0000000000350ac0] using SAR=1/1
[libx264 @ 0000000000350ac0] using cpu capabilities: MMX2 SSE2Fast SSSE3
SSE4.2
AVX FMA3 BMI2 AVX2
[libx264 @ 0000000000350ac0] profile High 4:2:2, level 3.1, 4:2:2, 10-bit
[libx264 @ 0000000000350ac0] 264 - core 157 r2970 5493be8 - 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=81 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'out2.mp4':
Metadata:
major_brand : qt
minor_version : 512
compatible_brands: qt
encoder : Lavf58.27.103
Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661),
yuv422p10le, 1280x48
0 [SAR 1:1 DAR 8:3], q=-1--1, 25 fps, 12800 tbn, 25 tbc (default)
Metadata:
encoder : Lavc58.52.100 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz,
stereo, flt
p, 128 kb/s (default)
Metadata:
handler_name : SoundHandler
encoder : Lavc58.52.100 aac
frame= 126 fps=0.0 q=40.0 size= 0kB time=00:00:05.14 bitrate=
0.1kbits/
frame= 207 fps=179 q=40.0 size= 0kB time=00:00:08.38 bitrate=
0.0kbits/
frame= 283 fps=170 q=40.0 size= 0kB time=00:00:11.43 bitrate=
0.0kbits/
frame= 354 fps=162 q=40.0 size= 256kB time=00:00:14.27 bitrate=
147.0kbits/
frame= 421 fps=156 q=40.0 size= 256kB time=00:00:16.93 bitrate=
123.8kbits/
frame= 486 fps=151 q=40.0 size= 256kB time=00:00:19.54 bitrate=
107.3kbits/
frame= 547 fps=147 q=40.0 size= 256kB time=00:00:21.99 bitrate=
95.4kbits/
frame= 605 fps=136 q=-1.0 Lsize= 653kB time=00:00:24.21 bitrate=
221.1kbits
/s dup=125 drop=0 speed=5.43x
video:255kB audio:380kB subtitle:0kB other streams:0kB global
headers:0kB muxing
overhead: 3.057025%
[libx264 @ 0000000000350ac0] frame I:3 Avg QP:20.56 size: 13583
[libx264 @ 0000000000350ac0] frame P:152 Avg QP:23.61 size: 1040
[libx264 @ 0000000000350ac0] frame B:450 Avg QP:28.21 size: 136
[libx264 @ 0000000000350ac0] consecutive B-frames: 0.8% 0.0% 0.0% 99.2%
[libx264 @ 0000000000350ac0] mb I I16..4: 54.8% 41.1% 4.0%
[libx264 @ 0000000000350ac0] mb P I16..4: 0.6% 0.6% 0.0% P16..4:
15.1% 0.3
% 0.3% 0.0% 0.0% skip:83.0%
[libx264 @ 0000000000350ac0] mb B I16..4: 0.0% 0.0% 0.0% B16..8:
0.9% 0.0
% 0.0% direct: 1.4% skip:97.7% L0:38.5% L1:61.3% BI: 0.2%
[libx264 @ 0000000000350ac0] 8x8 transform intra:44.4% inter:91.2%
[libx264 @ 0000000000350ac0] coded y,uvDC,uvAC intra: 18.1% 59.8% 3.1%
inter: 0.
1% 4.3% 0.0%
[libx264 @ 0000000000350ac0] i16 v,h,dc,p: 59% 21% 15% 5%
[libx264 @ 0000000000350ac0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 22% 14% 53%
3% 2%
2% 2% 2% 1%
[libx264 @ 0000000000350ac0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 18% 16% 30%
7% 8%
6% 7% 4% 5%
[libx264 @ 0000000000350ac0] i8c dc,h,v,p: 54% 19% 25% 2%
[libx264 @ 0000000000350ac0] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0000000000350ac0] ref P L0: 75.2% 11.6% 13.2%
[libx264 @ 0000000000350ac0] ref B L0: 79.8% 18.1% 2.1%
[libx264 @ 0000000000350ac0] ref B L1: 97.2% 2.8%
[libx264 @ 0000000000350ac0] kb/s:85.96
[aac @ 000000000033a080] Qavg: 187.870
More information about the ffmpeg-user
mailing list