Opened 9 years ago

Closed 8 years ago

#5411 closed defect (fixed)

Trim filter doesn't work with time specified as HH:MM:SS

Reported by: Mulvya Owned by:
Priority: important Component: avfilter
Version: git-master Keywords: trim regression
Cc: Michael Niedermayer Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description (last modified by Carl Eugen Hoyos)

The trim filter doesn't work with time expressed as [HH:]MM:SS[.m], but does work with S.m format

llogan suggests, "Possibly a regression due to 9219ec93b145725ac74fbfbde7f67ac5135b85cf

ffmpeg -i s.mp4 -vf "trim=start='00:00':end='00:05'" -an trim-hms.mp4

ffmpeg version N-79209-gb3eda69 Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 5.3.0 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmfx --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-decklink --enable-zlib
  libavutil      55. 19.100 / 55. 19.100
  libavcodec     57. 33.100 / 57. 33.100
  libavformat    57. 29.101 / 57. 29.101
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 40.102 /  6. 40.102
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  0.101 /  2.  0.101
  libpostproc    54.  0.100 / 54.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 's.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf56.11.100
  Duration: 00:03:14.83, start: 0.000000, bitrate: 1276 kb/s
    Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 1171 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 96 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
[libx264 @ 00000000029764c0] using SAR=1/1
[libx264 @ 00000000029764c0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 LZCNT BMI2
[libx264 @ 00000000029764c0] profile High, level 3.1
[libx264 @ 00000000029764c0] 264 - core 148 r2665 a01e339 - H.264/MPEG-4 AVC codec - Copyleft 2003-2016 - 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=6 lookahead_threads=1 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=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 'trim-hms.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf57.29.101
    Stream #0:0(eng): Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=-1--1, 30 fps, 15360 tbn, 30 tbc (default)
    Metadata:
      handler_name    : VideoHandler
      encoder         : Lavc57.33.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Press [q] to stop, [?] for help
frame=    0 fps=0.0 q=0.0 Lsize=       0kB time=00:00:00.00 bitrate=N/A speed=   0x   
video:0kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
ffmpeg -i s.mp4 -vf "trim=start='0.5':end='5.7'" -an trim-s.mp4

ffmpeg version N-79209-gb3eda69 Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 5.3.0 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmfx --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-decklink --enable-zlib
  libavutil      55. 19.100 / 55. 19.100
  libavcodec     57. 33.100 / 57. 33.100
  libavformat    57. 29.101 / 57. 29.101
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 40.102 /  6. 40.102
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  0.101 /  2.  0.101
  libpostproc    54.  0.100 / 54.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 's.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf56.11.100
  Duration: 00:03:14.83, start: 0.000000, bitrate: 1276 kb/s
    Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 1171 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 96 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
[libx264 @ 0000000002c164c0] using SAR=1/1
[libx264 @ 0000000002c164c0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 LZCNT BMI2
[libx264 @ 0000000002c164c0] profile High, level 3.1
[libx264 @ 0000000002c164c0] 264 - core 148 r2665 a01e339 - H.264/MPEG-4 AVC codec - Copyleft 2003-2016 - 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=6 lookahead_threads=1 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=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 'trim-s.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf57.29.101
    Stream #0:0(eng): Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=-1--1, 30 fps, 15360 tbn, 30 tbc (default)
    Metadata:
      handler_name    : VideoHandler
      encoder         : Lavc57.33.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Press [q] to stop, [?] for help
frame=  132 fps=0.0 q=29.0 size=      41kB time=00:00:02.66 bitrate= 127.4kbits/s dup=15 drop=0 speed=5.27x   
frame=  171 fps=138 q=-1.0 Lsize=     312kB time=00:00:05.63 bitrate= 454.0kbits/s dup=15 drop=0 speed=4.54x   
video:309kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.895382%
[libx264 @ 0000000002c164c0] frame I:2     Avg QP:11.05  size: 10221
[libx264 @ 0000000002c164c0] frame P:52    Avg QP:17.54  size:  4610
[libx264 @ 0000000002c164c0] frame B:117   Avg QP:17.11  size:   479
[libx264 @ 0000000002c164c0] consecutive B-frames:  6.4%  7.0%  0.0% 86.5%
[libx264 @ 0000000002c164c0] mb I  I16..4: 64.6% 26.6%  8.8%
[libx264 @ 0000000002c164c0] mb P  I16..4:  2.7%  5.3%  0.6%  P16..4: 13.5%  2.7%  1.7%  0.0%  0.0%    skip:73.5%
[libx264 @ 0000000002c164c0] mb B  I16..4:  0.1%  0.1%  0.0%  B16..8:  5.3%  0.2%  0.0%  direct: 0.7%  skip:93.6%  L0:43.9% L1:53.7% BI: 2.4%
[libx264 @ 0000000002c164c0] 8x8 transform intra:50.4% inter:57.6%
[libx264 @ 0000000002c164c0] coded y,uvDC,uvAC intra: 11.9% 24.5% 4.4% inter: 2.2% 4.6% 0.2%
[libx264 @ 0000000002c164c0] i16 v,h,dc,p: 70% 12%  8% 10%
[libx264 @ 0000000002c164c0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 50% 10% 35%  1%  1%  1%  1%  1%  1%
[libx264 @ 0000000002c164c0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 36% 18% 20%  5%  4%  5%  4%  4%  4%
[libx264 @ 0000000002c164c0] i8c dc,h,v,p: 72% 10% 17%  1%
[libx264 @ 0000000002c164c0] Weighted P-Frames: Y:42.3% UV:42.3%
[libx264 @ 0000000002c164c0] ref P L0: 77.7% 11.7%  7.9%  2.5%  0.3%
[libx264 @ 0000000002c164c0] ref B L0: 84.6% 13.9%  1.6%
[libx264 @ 0000000002c164c0] ref B L1: 95.3%  4.7%
[libx264 @ 0000000002c164c0] kb/s:443.73

Change History (8)

comment:1 by Carl Eugen Hoyos, 9 years ago

Description: modified (diff)

comment:2 by Carl Eugen Hoyos, 9 years ago

Keywords: trim added

I am unable to reproduce the regression, please provide command line and console output for a working revision.

comment:3 by Mulvya, 9 years ago

I cannot. I rely on precompiled Windows binaries. I can't find a binary featuring the commit before the suggested regression.

comment:4 by llogan, 9 years ago

Example input:

$ ./ffmpeg -f lavfi -i testsrc=d=30 trim.mp4

9219ec93b145725ac74fbfbde7f67ac5135b85cf creates an invalid output. Behavior with current git master is the same. Using starti and endi instead will produce correct output, but the *i options are not documented in doc/filters.texi.

$ ./ffmpeg -i trim.mp4 -vf "trim=start=00:00:00:end=00:00:05" output.mp4
ffmpeg version N-54688-g9219ec9 Copyright (c) 2000-2013 the FFmpeg developers
  built on Apr  7 2016 17:39:09 with gcc 5.3.0 (GCC)
  configuration: 
  libavutil      52. 39.100 / 52. 39.100
  libavcodec     55. 18.102 / 55. 18.102
  libavformat    55. 12.102 / 55. 12.102
  libavdevice    55.  3.100 / 55.  3.100
  libavfilter     3. 80.101 /  3. 80.101
  libswscale      2.  3.100 /  2.  3.100
  libswresample   0. 17.102 /  0. 17.102
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'trim.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2mp41
    encoder         : Lavf55.12.102
  Duration: 00:00:30.00, start: 0.000000, bitrate: 282 kb/s
    Stream #0:0(und): Video: mpeg4 (Simple Profile) (mp4v / 0x7634706D), yuv420p, 320x240 [SAR 1:1 DAR 4:3], 281 kb/s, 25 fps, 25 tbr, 12800 tbn, 25 tbc
    Metadata:
      handler_name    : VideoHandler
Output #0, mp4, to 'output.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2mp41
    encoder         : Lavf55.12.102
    Stream #0:0(und): Video: mpeg4 ( [0][0][0] / 0x0020), yuv420p, 320x240 [SAR 1:1 DAR 4:3], q=2-31, 200 kb/s, 12800 tbn, 25 tbc
    Metadata:
      handler_name    : VideoHandler
Stream mapping:
  Stream #0:0 -> #0:0 (mpeg4 -> mpeg4)
Press [q] to stop, [?] for help
frame=    0 fps=0.0 q=0.0 Lsize=       0kB time=00:00:00.00 bitrate=N/A    
video:0kB audio:0kB subtitle:0 global headers:0kB muxing overhead 448.936170%

b3405b1bdacf83f1b9116e70b8cbd3542916b628 creates the trimmed output as expected.

$ ./ffmpeg -i trim.mp4 -vf "trim=start=00:00:00:end=00:00:05" output.mp4
ffmpeg version N-54686-gb3405b1 Copyright (c) 2000-2013 the FFmpeg developers
  built on Apr  7 2016 17:33:25 with gcc 5.3.0 (GCC)
  configuration: 
  libavutil      52. 39.100 / 52. 39.100
  libavcodec     55. 18.102 / 55. 18.102
  libavformat    55. 12.102 / 55. 12.102
  libavdevice    55.  3.100 / 55.  3.100
  libavfilter     3. 80.101 /  3. 80.101
  libswscale      2.  3.100 /  2.  3.100
  libswresample   0. 17.102 /  0. 17.102
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'trim.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2mp41
    encoder         : Lavf55.12.102
  Duration: 00:00:30.00, start: 0.000000, bitrate: 282 kb/s
    Stream #0:0(und): Video: mpeg4 (Simple Profile) (mp4v / 0x7634706D), yuv420p, 320x240 [SAR 1:1 DAR 4:3], 281 kb/s, 25 fps, 25 tbr, 12800 tbn, 25 tbc
    Metadata:
      handler_name    : VideoHandler
Output #0, mp4, to 'output.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2mp41
    encoder         : Lavf55.12.102
    Stream #0:0(und): Video: mpeg4 ( [0][0][0] / 0x0020), yuv420p, 320x240 [SAR 1:1 DAR 4:3], q=2-31, 200 kb/s, 12800 tbn, 25 tbc
    Metadata:
      handler_name    : VideoHandler
Stream mapping:
  Stream #0:0 -> #0:0 (mpeg4 -> mpeg4)
Press [q] to stop, [?] for help
frame=  125 fps=0.0 q=2.0 Lsize=     195kB time=00:00:05.00 bitrate= 319.4kbits/s    
video:194kB audio:0kB subtitle:0 global headers:0kB muxing overhead 0.682931%

comment:5 by Carl Eugen Hoyos, 9 years ago

Keywords: regression added
Priority: normalimportant
Status: newopen

Apparently a regression.

comment:6 by Michael Niedermayer, 8 years ago

patch reverting the comit on the ML

comment:7 by Michael Niedermayer, 8 years ago

Cc: Michael Niedermayer added

comment:8 by Michael Niedermayer, 8 years ago

Resolution: fixed
Status: openclosed
Note: See TracTickets for help on using tickets.