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

Cyril B. cbay
Fri Oct 19 10:31:45 CEST 2007


Michael Niedermayer wrote:

> Hi
> 
> On Tue, Oct 16, 2007 at 05:02:39PM +0200, Cyril B. wrote:
>> Hi,
>> 
>> 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
>> encoder.
> [...]
>> [2] 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 [2] 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 [1]
(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.

[1] http://www.tactilemedia.com/info/MCI_Control_Info.html

-- 
Cyril B.





More information about the ffmpeg-devel mailing list