[FFmpeg-devel] [PATCH] Fix Incorrect Display of ASF/WMV Duration

Josh Harris qt
Sat Aug 29 13:19:07 CEST 2009


On Tue, 22 Apr 2008 20:08:39 +0000 (20:08 +0000) a commit was made to
libavformat/asf.c to "read asf file header fields in the right order." 
The code changed the order so that play_time is correctly read from the
asf/wmv header before send_time, however, the calculation for file
duration was not changed.  When the header was read in the wrong order,
the file duration was calculated using send_time and so ffmpeg displayed
the correct file duration.  Now that play_time and send_time have been
reversed, the file duration calculation needs to be reversed also.

The original commit can be viewed here:
http://git.ffmpeg.org/?p=ffmpeg;a=commit;h=c2f3cba296fb760c3734ba749fa7a8575b6442cc


Using Microsoft's "Windows Media ASF View," the file TL1-001.wmv has the
following attributes:
Duration      00:12.000
Send Duration 00:06.976
Preroll       00:05.000


And output from two different revisions of ffmpeg is as follows:

This is correct

FFmpeg version SVN-r12920, Copyright (c) 2000-2008 Fabrice Bellard, et al.
  configuration: --enable-memalign-hack --enable-postproc
--enable-swscale --enable-gpl --enable-liba52 --enable-libfaac
--enable-libfaad --enable-libgsm --enable-libmp3lame --enable-libvorbis
--enable-libtheora --enable-libx264 --enable-libxvid --disable-ffserver
--disable-ffplay --enable-avisynth --enable-small --enable-pthreads
--cpu=i686
  libavutil version: 49.6.0
  libavcodec version: 51.55.0
  libavformat version: 52.13.0
  libavdevice version: 52.0.0
  built on Apr 21 2008 19:08:52, gcc: 4.2.3

Seems stream 0 codec frame rate differs from container frame rate:
1000.00 (1000/1) -> 30.00 (30/1)
Input #0, asf, from 'F:/TLI1-001.wmv':
  Duration: 00:00:07.00, start: 5.000000, bitrate: 5893 kb/s
    Stream #0.0: Video: wmv3, yuv420p, 864x1232, 10000 kb/s, 30.00 tb(r)


This is incorrect

FFmpeg version SVN-r19737, Copyright (c) 2000-2009 Fabrice Bellard, et al.
  configuration: --enable-memalign-hack --prefix=/mingw
--cross-prefix=i686-mingw32- --cc=ccache-i686-mingw32-gcc
--target-os=mingw32 --arch=i686 --cpu=i686 --enable-avisynth
--enable-gpl --enable-zlib --enable-bzlib --enable-libgsm
--enable-libfaad --enable-pthreads --enable-libvorbis --enable-libtheora
--enable-libspeex --enable-libmp3lame --enable-libopenjpeg
--enable-libxvid --enable-libschroedinger --enable-libx264
  libavutil     50. 3. 0 / 50. 3. 0
  libavcodec    52.34. 0 / 52.34. 0
  libavformat   52.38. 0 / 52.38. 0
  libavdevice   52. 2. 0 / 52. 2. 0
  libswscale     0. 7. 1 /  0. 7. 1
  built on Aug 29 2009 04:03:37, gcc: 4.2.4

Seems stream 0 codec frame rate differs from container frame rate:
1000.00 (1000/1) -> 30.00 (30/1)
Input #0, asf, from 'F:/TLI1-001.wmv':
  Duration: 00:00:01.97, start: 5.000000, bitrate: 20878 kb/s
    Stream #0.0(eng): Video: wmv3, yuv420p, 864x1232, 10000 kb/s, 30
tbr, 1k tbn, 1k tbc
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: asf_r18800.diff
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090829/3268e5ea/attachment.txt>



More information about the ffmpeg-devel mailing list