[FFmpeg-devel] [PATCH] WAV file length (writing to stdout)

Cyril B. cbay
Tue Oct 16 17:02:39 CEST 2007


As reported recently on this mailing list [1], ffmpeg sets 0 as file length
in the WAV header if output is streamed (for instance, when outputting to
stdout). Nero AAC encoder does not accept such streams ('could not parse
WAV file' error).

The WAV file specs [2] say the file length (ChunkSize) must be 36 + data
length. The included patch writes 36 instead of 0, which satisfies Nero

I tested with MPlayer, VLC and Xine and they work fine (as before) when
reading a streamed WAV. The patch has no effect with non-streamed WAV
outputs as the file length is overwritten in the trailer anyway.

To reproduce the tests:
  * ffmpeg -i input.mp3 -f wav > output.wav
  * check that mplayer/vlc/xine/nero/... can read output.wav

[1] http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/2007-August/034155.html
[2] http://ccrma.stanford.edu/courses/422/projects/WaveFormat/

Cyril B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: wav-file-length.patch
Type: text/x-diff
Size: 375 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20071016/2c47771e/attachment.patch>

More information about the ffmpeg-devel mailing list