[FFmpeg-devel] Patch to WAV to accurately report duration

Frank Barchard fbarchard
Tue Jan 11 03:51:18 CET 2011


Patch to accurately report duration of a WAV.

Without the patch, ffmpeg reports a warning:

[wav @ 01a5d1b0] Estimating duration from bitrate, this may be inaccurate
Input #0, wav, from 'bruce2.wav':
  Duration: 00:00:00.25, bitrate: 1536 kb/s

and the duration would be slightly off.  I think because the 44 byte header
was not accounted for?
With the patch there is no warning and the duration is more accurate.

The inaccuracy most affects very short WAV's.  I made a test case of 0.25
seconds:
ffmpeg -y -i StEdwardsPNG.mov -ss 00:01:00 -t 00:00:00.25 -vn -ac 2 -acodec
pcm_s16le bruce2.wav

Without patch
>media_bench.exe --stream=audio d:\mediatests\bruce\bruce2.wav
* Stream #0: pcm_s16le (PCM signed 16-bit little-endian)
     Frames:         12
   Duration:     256.23 ms

With patch
>media_bench.exe --stream=audio d:\mediatests\bruce\bruce2.wav
* Stream #0: pcm_s16le (PCM signed 16-bit little-endian)
     Frames:         12
   Duration:     256.00 ms
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 22_wav_duration.patch
Type: application/octet-stream
Size: 636 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20110110/ef8d32cd/attachment.obj>



More information about the ffmpeg-devel mailing list