[FFmpeg-trac] #1444(undetermined:new): Incorrect duration displayed in webm file

FFmpeg trac at avcodec.org
Wed Jun 13 05:11:46 CEST 2012


#1444: Incorrect duration displayed in webm file
-------------------------------------+-------------------------------------
             Reporter:  Squerp       |                     Type:  defect
               Status:  new          |                 Priority:  normal
            Component:               |                  Version:
  undetermined                       |  unspecified
             Keywords:  Duration,    |               Blocked By:
  webm, transcoding                  |  Reproduced by developer:  0
             Blocking:               |
Analyzed by developer:  0            |
-------------------------------------+-------------------------------------
 Summary of the bug: Ffmpeg says that a video is longer than it actually
 is.
 How to reproduce:
 1. Download
 https://saveyoutube.com/?url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DeRsGyueVLvQ
 as a 480p webm (named cliff.webm)
 2. Enter the following console commands and observe output
 {{{
 $ ffmpeg -y -i cliff.webm -threads 8 -f webm -vcodec libvpx -g 120 -level
 216 -profile 0 -qmax 42 -qmin 10 -rc_buf_aggressivity 0.95 -b:v 2M -acodec
 libvorbis -aq 70 -ac 2 transcoded.webm
 ffmpeg version N-41027-ge02e58f Copyright (c) 2000-2012 the FFmpeg
 developers
   built on May 25 2012 13:09:41 with gcc 4.6.3
   configuration: --enable-gpl --enable-version3 --disable-w32threads
 --enable-runtime-cpudetect --enable-avisynth --enable-bzlib --enable-
 frei0r --enable-libass --enable-libcelt --enable-libopencore-amrnb
 --enable-libopencore-amrwb --enable-libfreetype --enable-libgsm --enable-
 libmp3lame --enable-libnut --enable-libopenjpeg --enable-librtmp --enable-
 libschroedinger --enable-libspeex --enable-libtheora --enable-libutvideo
 --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-
 libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
   libavutil      51. 54.100 / 51. 54.100
   libavcodec     54. 23.100 / 54. 23.100
   libavformat    54.  6.100 / 54.  6.100
   libavdevice    54.  0.100 / 54.  0.100
   libavfilter     2. 77.100 /  2. 77.100
   libswscale      2.  1.100 /  2.  1.100
   libswresample   0. 15.100 /  0. 15.100
   libpostproc    52.  0.100 / 52.  0.100
 Input #0, matroska,webm, from 'cliff.webm':
   Duration: 00:00:15.07, start: 0.000000, bitrate: 753 kb/s
     Stream #0:0(eng): Video: vp8, yuv420p, 640x360, SAR 1:1 DAR 16:9, 1k
 fps, 1k tbr, 1k tbn, 1k tbc (default)
     Stream #0:1: Audio: vorbis, 44100 Hz, stereo, s16 (default)
 Please use -profile:a or -profile:v, -profile is ambiguous
 [buffer @ 0000000001e5fe60] w:640 h:360 pixfmt:yuv420p tb:1/1000 sar:1/1
 sws_param:flags=2
 [buffersink @ 0000000001dd6880] No opaque field provided
 [aformat @ 0000000001dd7720] auto-inserting filter 'auto-inserted
 resampler 0' between the filter 'src' and the filter 'aformat'
 [aresample @ 00000000003ecf40] chl:stereo fmt:s16 r:44100Hz -> chl:stereo
 fmt:flt r:44100Hz
 [libvpx @ 0000000001e5f080] v1.0.0
 Output #0, webm, to 'transcoded.webm':
   Metadata:
     encoder         : Lavf54.6.100
     Stream #0:0(eng): Video: vp8, yuv420p, 640x360 [SAR 1:1 DAR 16:9],
 q=10-42, 2000 kb/s, 1k tbn, 1k tbc (default)
     Stream #0:1: Audio: vorbis, 44100 Hz, stereo, flt (default)
 Stream mapping:
   Stream #0:0 -> #0:0 (vp8 -> libvpx)
   Stream #0:1 -> #0:1 (vorbis -> libvorbis)
 Press [q] to stop, [?] for help
 [libvorbis @ 0000000003c56d60] Que input is backward in time
     Last message repeated 8 times
 [webm @ 0000000001e576a0] Audio timestamp 2200 < 2207 invalid, cliping
 [webm @ 0000000001e576a0] Audio timestamp 2203 < 2207 invalid, cliping
 [libvorbis @ 0000000003c56d60] Que input is backward in time
     Last message repeated 1 times
 [webm @ 0000000001e576a0] Audio timestamp 3228 < 3235 invalid, cliping
 [webm @ 0000000001e576a0] Audio timestamp 3230 < 3235 invalid, cliping
 [libvorbis @ 0000000003c56d60] Que input is backward in time
     Last message repeated 2 times
 [webm @ 0000000001e576a0] Audio timestamp 3359 < 3367 invalid, cliping
 [webm @ 0000000001e576a0] Audio timestamp 3362 < 3367 invalid, cliping
 [webm @ 0000000001e576a0] Audio timestamp 3361 < 3368 invalid, cliping
 [webm @ 0000000001e576a0] Audio timestamp 3364 < 3368 invalid, cliping
 [libvorbis @ 0000000003c56d60] Que input is backward in time
     Last message repeated 1 times
 Que input is backward in timee=     470kB time=00:00:05.03 bitrate=
 764.2kbits/s
 [libvorbis @ 0000000003c56d60] Que input is backward in time
 [webm @ 0000000001e576a0] Audio timestamp 6307 < 6314 invalid, cliping
 [webm @ 0000000001e576a0] Audio timestamp 6310 < 6314 invalid, cliping
 Que input is backward in timee=     854kB time=00:00:07.10 bitrate=
 984.3kbits/s
 [libvorbis @ 0000000003c56d60] Que input is backward in time
     Last message repeated 2 times
 Que input is backward in timee=    1396kB time=00:00:09.27
 bitrate=1233.1kbits/s
 [libvorbis @ 0000000003c56d60] Que input is backward in time
 [webm @ 0000000001e576a0] Audio timestamp 12199 < 12206 invalid, cliping
 [webm @ 0000000001e576a0] Audio timestamp 12202 < 12206 invalid, cliping
 [libvorbis @ 0000000003c56d60] Que input is backward in time
     Last message repeated 1 times
 [webm @ 0000000001e576a0] Audio timestamp 12615 < 12623 invalid, cliping
 [webm @ 0000000001e576a0] Audio timestamp 12618 < 12623 invalid, cliping
 [webm @ 0000000001e576a0] Audio timestamp 12617 < 12624 invalid, cliping
 [webm @ 0000000001e576a0] Audio timestamp 12620 < 12624 invalid, cliping
 Que input is backward in timee=    1812kB time=00:00:11.61
 bitrate=1278.5kbits/s
 [libvorbis @ 0000000003c56d60] Que input is backward in time
 [webm @ 0000000001e576a0] Audio timestamp 12928 < 12935 invalid, cliping
 [webm @ 0000000001e576a0] Audio timestamp 12931 < 12935 invalid, cliping
 [libvorbis @ 0000000003c56d60] Que input is backward in time
 [webm @ 0000000001e576a0] Audio timestamp 12971 < 12978 invalid, cliping
 [webm @ 0000000001e576a0] Audio timestamp 12974 < 12978 invalid, cliping
 [libvorbis @ 0000000003c56d60] Que input is backward in time
     Last message repeated 7 times
 [webm @ 0000000001e576a0] Audio timestamp 14650 < 14658 invalid, cliping
 [webm @ 0000000001e576a0] Audio timestamp 14653 < 14658 invalid, cliping
 [webm @ 0000000001e576a0] Audio timestamp 14652 < 14659 invalid, cliping
 [webm @ 0000000001e576a0] Audio timestamp 14655 < 14659 invalid, cliping
 [libvorbis @ 0000000003c56d60] Que input is backward in time
 frame=  449 fps=140 q=0.0 Lsize=    2456kB time=00:00:14.94
 bitrate=1345.8kbits/s
 video:1903kB audio:539kB global headers:4kB muxing overhead 0.419683%

 $ ffmpeg.exe -i transcoded.webm
 ffmpeg version N-41027-ge02e58f Copyright (c) 2000-2012 the FFmpeg
 developers
   built on May 25 2012 13:09:41 with gcc 4.6.3
   configuration: --enable-gpl --enable-version3 --disable-w32threads
 --enable-runtime-cpudetect --enable-avisynth --enable-bzlib --enable-
 frei0r --enable-libass --enable-libcelt --enable-libopencore-amrnb
 --enable-libopencore-amrwb --enable-libfreetype --enable-libgsm --enable-
 libmp3lame --enable-libnut --enable-libopenjpeg --enable-librtmp --enable-
 libschroedinger --enable-libspeex --enable-libtheora --enable-libutvideo
 --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-
 libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
   libavutil      51. 54.100 / 51. 54.100
   libavcodec     54. 23.100 / 54. 23.100
   libavformat    54.  6.100 / 54.  6.100
   libavdevice    54.  0.100 / 54.  0.100
   libavfilter     2. 77.100 /  2. 77.100
   libswscale      2.  1.100 /  2.  1.100
   libswresample   0. 15.100 /  0. 15.100
   libpostproc    52.  0.100 / 52.  0.100
 Input #0, matroska,webm, from 'transcoded.webm':
   Duration: 00:00:16.09, start: 0.000000, bitrate: 1250 kb/s
     Stream #0:0(eng): Video: vp8, yuv420p, 640x360, SAR 1:1 DAR 16:9, 1k
 fps, 1k tbr, 1k tbn, 1k tbc (default)
     Stream #0:1: Audio: vorbis, 44100 Hz, stereo, s16 (default)
 At least one output file must be specified

 $ ffmpeg.exe -i transcoded.webm -ss 16 -vframes 1 test.png
 ffmpeg version N-41027-ge02e58f Copyright (c) 2000-2012 the FFmpeg
 developers
   built on May 25 2012 13:09:41 with gcc 4.6.3
   configuration: --enable-gpl --enable-version3 --disable-w32threads
 --enable-runtime-cpudetect --enable-avisynth --enable-bzlib --enable-
 frei0r --enable-libass --enable-libcelt --enable-libopencore-amrnb
 --enable-libopencore-amrwb --enable-libfreetype --enable-libgsm --enable-
 libmp3lame --enable-libnut --enable-libopenjpeg --enable-librtmp --enable-
 libschroedinger --enable-libspeex --enable-libtheora --enable-libutvideo
 --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-
 libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
   libavutil      51. 54.100 / 51. 54.100
   libavcodec     54. 23.100 / 54. 23.100
   libavformat    54.  6.100 / 54.  6.100
   libavdevice    54.  0.100 / 54.  0.100
   libavfilter     2. 77.100 /  2. 77.100
   libswscale      2.  1.100 /  2.  1.100
   libswresample   0. 15.100 /  0. 15.100
   libpostproc    52.  0.100 / 52.  0.100
 Input #0, matroska,webm, from 'transcoded.webm':
   Duration: 00:00:16.09, start: 0.000000, bitrate: 1250 kb/s
     Stream #0:0(eng): Video: vp8, yuv420p, 640x360, SAR 1:1 DAR 16:9, 1k
 fps, 1k tbr, 1k tbn, 1k tbc (default)
     Stream #0:1: Audio: vorbis, 44100 Hz, stereo, s16 (default)
 [buffer @ 0000000003ca5840] w:640 h:360 pixfmt:yuv420p tb:1/1000 sar:1/1
 sws_param:flags=2
 [buffersink @ 0000000001dd2b20] No opaque field provided
 [format @ 0000000001dd32e0] auto-inserting filter 'auto-inserted scaler 0'
 between the filter 'src' and the filter 'format'
 [scale @ 0000000001dd3680] w:640 h:360 fmt:yuv420p sar:1/1 -> w:640 h:360
 fmt:rgb24 sar:1/1 flags:0x4
 Output #0, image2, to 'test.png':
   Metadata:
     encoder         : Lavf54.6.100
     Stream #0:0(eng): Video: png, rgb24, 640x360 [SAR 1:1 DAR 16:9],
 q=2-31, 200 kb/s, 90k tbn, 1k tbc (default)
 Stream mapping:
   Stream #0:0 -> #0:0 (vp8 -> png)
 Press [q] to stop, [?] for help
 frame=    0 fps=0.0 q=0.0 Lsize=       0kB time=00:00:00.00 bitrate=
 0.0kbits/s
 video:0kB audio:0kB global headers:0kB muxing overhead nan%
 Output file is empty, nothing was encoded (check -ss / -t / -frames
 parameters if used)
 }}}

 Observed: Although ffmpeg indicates that the file is 16.09 seconds long,
 it cannot get a thumbnail 16 seconds into the file.

 Expected: Duration displays correctly, so that the thumbnail command works
 with any number less than the stated duration.

 Notes: burek on IRC confirmed that this is a bug. Something seems to be
 wrong with the way saveyoutube's webm files are done (maybe youtube's),
 but that should get fixed on transcode. The transcoding confirms that the
 file is actually only 14.94 seconds long, however the duration is still
 displayed wrong in the newly transcoded file (observe the second command
 above).

 In my particular use case, I need to be able to get the duration of the
 video after transcoding it. My current work-around is to scrape the
 "time=" value while transcoding, but this is not ideal. Ideally after
 transcoding, I could use ffmpeg or ffprobe to get the correct duration,
 without needing to remember it from the transcode; a duration can be
 displayed by these efficiently (without reading the whole file), but this
 duration is not correct.

-- 
Ticket URL: <https://ffmpeg.org/trac/ffmpeg/ticket/1444>
FFmpeg <http://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list