[Ffmpeg-devel] [PATCH] ASF Duration

Brian Brice bbrice
Sat Sep 30 00:49:58 CEST 2006


Hello.
I've found that encoding with the ASF output format always gave a
duration that was off by 2 seconds.  For example, I transcode 30
seconds worth to an ASF file, and the result file has a reported
duration of 28.5 seconds.  The duration written in the ASF header
does not take into account the preroll of 2 seconds.  To find the
duration of an ASF clip, the play duration has the preroll subtracted
from it.  In this case, it would always be off by 2 seconds.  This
patch takes the preroll into account.  Thanks!

pollux:~> ./ffmpeg -i INPUT.avi -t 00:00:30 OUTPUT.asf
FFmpeg version SVN-r6197, Copyright (c) 2000-2004 Fabrice Bellard
   libavutil version: 49.0.0
   libavcodec version: 51.13.0
   libavformat version: 50.5.0
   built on Sep 29 2006 14:22:51, gcc: 3.4.2 (mingw-special)
Input #0, avi, from 'INPUT.avi':
   Duration: 00:03:50.8, start: 0.000000, bitrate: 657 kb/s
   Stream #0.0: Video: mpeg4, yuv420p, 352x240, 29.98 fps(r)
   Stream #0.1: Audio: mp3, 32000 Hz, stereo, 96 kb/s
Output #0, asf, to 'OUTPUT.asf':
   Stream #0.0: Video: msmpeg4, yuv420p, 352x240, q=2-31, 200 kb/s, 
29.98 fps(c)
   Stream #0.1: Audio: mp3, 32000 Hz, stereo, 64 kb/s
Stream mapping:
   Stream #0.0 -> #0.0
   Stream #0.1 -> #0.1
[msmpeg4 @ 00721000]warning, clipping 1 dct coefficients to -127..127
video:853kB audio:239kB global headers:0kB muxing overhead -99.950162%

pollux:~> ./ffmpeg -i OUTPUT.asf
FFmpeg version SVN-r6197, Copyright (c) 2000-2004 Fabrice Bellard
   libavutil version: 49.0.0
   libavcodec version: 51.13.0
   libavformat version: 50.5.0
   built on Sep 29 2006 14:22:51, gcc: 3.4.2 (mingw-special)

Seems that stream 0 comes from film source: 1000.00 (1000/1) -> 29.97 
(30000/1001)
Input #0, asf, from 'OUTPUT.asf':
   Duration: 00:00:28.5, start: 2.000000, bitrate: 303 kb/s
   Stream #0.0: Video: msmpeg4, yuv420p, 352x240, 29.97 fps(r)
   Stream #0.1: Audio: mp3, 32000 Hz, stereo, 64 kb/s
Must supply at least one output file

-- 
Brian Brice
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: asf-enc-prerollduration.patch
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20060929/24efce26/attachment.txt>



More information about the ffmpeg-devel mailing list