[FFmpeg-devel] [PATCH] WAV file length (writing to stdout)
Fri Oct 19 10:31:45 CEST 2007
Michael Niedermayer wrote:
> On Tue, Oct 16, 2007 at 05:02:39PM +0200, Cyril B. wrote:
>> As reported recently on this mailing list , 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  say the file length (ChunkSize) must be 36 + data
>> length. The included patch writes 36 instead of 0, which satisfies Nero
>>  http://ccrma.stanford.edu/courses/422/projects/WaveFormat/
> no this is not the wav file spec
> parts of the wav file spec can be found if you search for
> "multimedia programming interface and data specification"
Sorry, I was not clear. The  actually pointed to a page that clearly said
that the file length was at least 36, based on the (real) specs. I just
pointed to that page as a quick way for you reviewers to check my patch was
not totally nonsense.
Of course, you can get to the same conclusion by reading the specs 
(which I did): a WAVE file has mandatory fmt-ck and wave-data chunks. If
you add up the space needed by these chunks (with the Pulse Code Modulation
as format specific fields), you get 36. Thus, a valid WAV file should
probably have a file length larger (or equal) than 36.
By the way, Nero AAC Encoder specifically checks for 36 or more. I tested
with 35, it fails. 36 or more, it passes.
More information about the ffmpeg-devel