[FFmpeg-user] Clipping inputs -t position with concat video filter

Christian Johannesen chrisjohannesen at gmail.com
Tue Feb 5 21:27:09 EET 2019


It's my understanding that the -t option can be used before or after the
input file. I've found that its more accurate with some input files if I
place the option after the input file. However, this impacts the ability to
use the concat video filter to combine multiple clips. When I set the -t
duration after the input last input clip does not appear in the output file
after using the concat video filter. If move the -t duration before the
input, the concat video filter outputs both clips.

Thanks,
Chris

-t before input:

>ffmpeg -y -ss 86.086 -t 4.004 -i countdownclock_720p2398_21min.mp4 -ss
1257.256 -t 4.004 -i countdownclock_720p2398_21min.mp4 -filter_complex
"[0:v:0][1:v:0]concat=n=2:v=1:a=0[concat_v]" -map "[concat_v]" -pix_fmt
yuv420p t_after_input.mp4
ffmpeg version N-93083-g8522d219ce Copyright (c) 2000-2019 the FFmpeg
developers
  built with gcc 8.2.1 (GCC) 20181201
  configuration: --enable-gpl --enable-version3 --enable-sdl2
--enable-fontconfig --enable-gnutls --enable-iconv --enable-libass
--enable-libdav1d --enable-libbluray --enable-libfreetype
--enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb
--enable-libopenjpeg --enable-libopus --enable-libshine --enable-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
--enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc
--enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom
--enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid
--enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2
--enable-avisynth --enable-libopenmpt
  libavutil      56. 26.100 / 56. 26.100
  libavcodec     58. 46.100 / 58. 46.100
  libavformat    58. 26.100 / 58. 26.100
  libavdevice    58.  6.101 / 58.  6.101
  libavfilter     7. 48.100 /  7. 48.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 'countdownclock_720p2398_21min.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2mp41
    encoder         : Lavf58.20.100
  Duration: 00:21:01.28, start: 0.000000, bitrate: 208 kb/s
    Stream #0:0(eng): Video: hevc (Rext) (hev1 / 0x31766568),
yuv422p10le(tv, progressive), 1280x720 [SAR 1:1 DAR 16:9], 113 kb/s, 23.98
fps, 23.98 tbr, 24k tbn, 23.98 tbc (default)
    Metadata:
      handler_name    : Apple Video Media Handler
      timecode        : 00:00:00:00
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz,
stereo, fltp, 88 kb/s (default)
    Metadata:
      handler_name    : Apple Sound Media Handler
    Stream #0:2(eng): Data: none (tmcd / 0x64636D74) (default)
    Metadata:
      handler_name    : Apple Video Media Handler
      timecode        : 00:00:00:00
Input #1, mov,mp4,m4a,3gp,3g2,mj2, from 'countdownclock_720p2398_21min.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2mp41
    encoder         : Lavf58.20.100
  Duration: 00:21:01.28, start: 0.000000, bitrate: 208 kb/s
    Stream #1:0(eng): Video: hevc (Rext) (hev1 / 0x31766568),
yuv422p10le(tv, progressive), 1280x720 [SAR 1:1 DAR 16:9], 113 kb/s, 23.98
fps, 23.98 tbr, 24k tbn, 23.98 tbc (default)
    Metadata:
      handler_name    : Apple Video Media Handler
      timecode        : 00:00:00:00
    Stream #1:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz,
stereo, fltp, 88 kb/s (default)
    Metadata:
      handler_name    : Apple Sound Media Handler
    Stream #1:2(eng): Data: none (tmcd / 0x64636D74) (default)
    Metadata:
      handler_name    : Apple Video Media Handler
      timecode        : 00:00:00:00
Stream mapping:
  Stream #0:0 (hevc) -> concat:in0:v0
  Stream #1:0 (hevc) -> concat:in1:v0
  concat -> Stream #0:0 (libx264)
Press [q] to stop, [?] for help
[libx264 @ 0000002f057e67c0] using SAR=1/1
[libx264 @ 0000002f057e67c0] using cpu capabilities: MMX2 SSE2Fast SSSE3
SSE4.2 AVX
[libx264 @ 0000002f057e67c0] profile High, level 3.1, 4:2:0, 8-bit
[libx264 @ 0000002f057e67c0] 264 - core 157 r2935 545de2f - H.264/MPEG-4
AVC codec - Copyleft 2003-2018 - 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=22
lookahead_threads=3 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=23
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 't_after_input.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2mp41
    encoder         : Lavf58.26.100
    Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv420p,
1280x720 [SAR 1:1 DAR 16:9], q=-1--1, 23.98 fps, 24k tbn, 23.98 tbc
(default)
    Metadata:
      encoder         : Lavc58.46.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
frame=  192 fps=153 q=-1.0 Lsize=      95kB time=00:00:07.88 bitrate=
98.5kbits/s speed=6.27x
video:92kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB
muxing overhead: 3.299863%
[libx264 @ 0000002f057e67c0] frame I:1     Avg QP:14.29  size: 12403
[libx264 @ 0000002f057e67c0] frame P:50    Avg QP:20.88  size:   918
[libx264 @ 0000002f057e67c0] frame B:141   Avg QP:28.98  size:   248
[libx264 @ 0000002f057e67c0] consecutive B-frames:  0.5%  1.0% 10.9% 87.5%
[libx264 @ 0000002f057e67c0] mb I  I16..4: 93.9%  0.5%  5.6%
[libx264 @ 0000002f057e67c0] mb P  I16..4:  0.1%  0.1%  0.2%  P16..4:
0.7%  0.2%  0.2%  0.0%  0.0%    skip:98.5%
[libx264 @ 0000002f057e67c0] mb B  I16..4:  0.0%  0.0%  0.0%  B16..8:
0.5%  0.1%  0.1%  direct: 0.0%  skip:99.2%  L0:50.8% L1:47.3% BI: 1.9%
[libx264 @ 0000002f057e67c0] 8x8 transform intra:8.0% inter:43.5%
[libx264 @ 0000002f057e67c0] coded y,uvDC,uvAC intra: 12.2% 19.2% 16.8%
inter: 0.1% 0.2% 0.1%
[libx264 @ 0000002f057e67c0] i16 v,h,dc,p: 93%  4%  3%  0%
[libx264 @ 0000002f057e67c0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu:  8%  7% 73%
5%  1%  1%  1%  3%  2%
[libx264 @ 0000002f057e67c0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 30% 20% 20%
8%  4%  5%  3%  6%  4%
[libx264 @ 0000002f057e67c0] i8c dc,h,v,p: 83%  8%  8%  1%
[libx264 @ 0000002f057e67c0] Weighted P-Frames: Y:2.0% UV:2.0%
[libx264 @ 0000002f057e67c0] ref P L0: 69.0%  5.3% 16.5%  9.2%
[libx264 @ 0000002f057e67c0] ref B L0: 67.4% 25.5%  7.1%
[libx264 @ 0000002f057e67c0] ref B L1: 88.7% 11.3%
[libx264 @ 0000002f057e67c0] kb/s:93.13

-t after input:

>ffmpeg -y -ss 86.086 -i countdownclock_720p2398_21min.mp4 -t 4.004 -ss
1257.256 -i countdownclock_720p2398_21min.mp4 -t 4.004 -filter_complex
"[0:v:0][1:v:0]concat=n=2:v=1:a=0[concat_v]" -map "[concat_v]" -pix_fmt
yuv420p t_before_input.mp4
ffmpeg version N-93083-g8522d219ce Copyright (c) 2000-2019 the FFmpeg
developers
  built with gcc 8.2.1 (GCC) 20181201
  configuration: --enable-gpl --enable-version3 --enable-sdl2
--enable-fontconfig --enable-gnutls --enable-iconv --enable-libass
--enable-libdav1d --enable-libbluray --enable-libfreetype
--enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb
--enable-libopenjpeg --enable-libopus --enable-libshine --enable-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
--enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc
--enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom
--enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid
--enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2
--enable-avisynth --enable-libopenmpt
  libavutil      56. 26.100 / 56. 26.100
  libavcodec     58. 46.100 / 58. 46.100
  libavformat    58. 26.100 / 58. 26.100
  libavdevice    58.  6.101 / 58.  6.101
  libavfilter     7. 48.100 /  7. 48.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 'countdownclock_720p2398_21min.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2mp41
    encoder         : Lavf58.20.100
  Duration: 00:21:01.28, start: 0.000000, bitrate: 208 kb/s
    Stream #0:0(eng): Video: hevc (Rext) (hev1 / 0x31766568),
yuv422p10le(tv, progressive), 1280x720 [SAR 1:1 DAR 16:9], 113 kb/s, 23.98
fps, 23.98 tbr, 24k tbn, 23.98 tbc (default)
    Metadata:
      handler_name    : Apple Video Media Handler
      timecode        : 00:00:00:00
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz,
stereo, fltp, 88 kb/s (default)
    Metadata:
      handler_name    : Apple Sound Media Handler
    Stream #0:2(eng): Data: none (tmcd / 0x64636D74) (default)
    Metadata:
      handler_name    : Apple Video Media Handler
      timecode        : 00:00:00:00
Input #1, mov,mp4,m4a,3gp,3g2,mj2, from 'countdownclock_720p2398_21min.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2mp41
    encoder         : Lavf58.20.100
  Duration: 00:21:01.28, start: 0.000000, bitrate: 208 kb/s
    Stream #1:0(eng): Video: hevc (Rext) (hev1 / 0x31766568),
yuv422p10le(tv, progressive), 1280x720 [SAR 1:1 DAR 16:9], 113 kb/s, 23.98
fps, 23.98 tbr, 24k tbn, 23.98 tbc (default)
    Metadata:
      handler_name    : Apple Video Media Handler
      timecode        : 00:00:00:00
    Stream #1:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz,
stereo, fltp, 88 kb/s (default)
    Metadata:
      handler_name    : Apple Sound Media Handler
    Stream #1:2(eng): Data: none (tmcd / 0x64636D74) (default)
    Metadata:
      handler_name    : Apple Video Media Handler
      timecode        : 00:00:00:00
Stream mapping:
  Stream #0:0 (hevc) -> concat:in0:v0
  Stream #1:0 (hevc) -> concat:in1:v0
  concat -> Stream #0:0 (libx264)
Press [q] to stop, [?] for help
[libx264 @ 0000008e20586d40] using SAR=1/1
[libx264 @ 0000008e20586d40] using cpu capabilities: MMX2 SSE2Fast SSSE3
SSE4.2 AVX
[libx264 @ 0000008e20586d40] profile High, level 3.1, 4:2:0, 8-bit
[libx264 @ 0000008e20586d40] 264 - core 157 r2935 545de2f - H.264/MPEG-4
AVC codec - Copyleft 2003-2018 - 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=22
lookahead_threads=3 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=23
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 't_before_input.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2mp41
    encoder         : Lavf58.26.100
    Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv420p,
1280x720 [SAR 1:1 DAR 16:9], q=-1--1, 23.98 fps, 24k tbn, 23.98 tbc
(default)
    Metadata:
      encoder         : Lavc58.46.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
frame=   96 fps=0.0 q=-1.0 Lsize=      47kB time=00:00:03.87 bitrate=
99.1kbits/s speed= 4.8x
video:45kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB
muxing overhead: 4.241057%
[libx264 @ 0000008e20586d40] frame I:1     Avg QP:14.29  size: 12403
[libx264 @ 0000008e20586d40] frame P:26    Avg QP:21.33  size:   654
[libx264 @ 0000008e20586d40] frame B:69    Avg QP:29.13  size:   232
[libx264 @ 0000008e20586d40] consecutive B-frames:  2.1%  0.0% 18.8% 79.2%
[libx264 @ 0000008e20586d40] mb I  I16..4: 93.9%  0.5%  5.6%
[libx264 @ 0000008e20586d40] mb P  I16..4:  0.0%  0.1%  0.1%  P16..4:
0.6%  0.2%  0.2%  0.0%  0.0%    skip:98.7%
[libx264 @ 0000008e20586d40] mb B  I16..4:  0.0%  0.0%  0.0%  B16..8:
0.5%  0.1%  0.1%  direct: 0.0%  skip:99.3%  L0:50.9% L1:47.1% BI: 2.0%
[libx264 @ 0000008e20586d40] 8x8 transform intra:4.3% inter:45.7%
[libx264 @ 0000008e20586d40] coded y,uvDC,uvAC intra: 6.8% 11.5% 10.1%
inter: 0.1% 0.2% 0.1%
[libx264 @ 0000008e20586d40] i16 v,h,dc,p: 95%  2%  3%  0%
[libx264 @ 0000008e20586d40] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu:  7%  6% 74%
5%  1%  1%  0%  3%  3%
[libx264 @ 0000008e20586d40] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 31% 19% 20%
7%  4%  5%  3%  5%  4%
[libx264 @ 0000008e20586d40] i8c dc,h,v,p: 89%  5%  5%  1%
[libx264 @ 0000008e20586d40] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0000008e20586d40] ref P L0: 67.8%  4.7% 16.9% 10.6%
[libx264 @ 0000008e20586d40] ref B L0: 66.6% 27.3%  6.1%
[libx264 @ 0000008e20586d40] ref B L1: 88.4% 11.6%
[libx264 @ 0000008e20586d40] kb/s:90.72


More information about the ffmpeg-user mailing list