[MPlayer-users] Possibly incorrect waveheader in -ao pcm

Reimar Döffinger Reimar.Doeffinger at gmx.de
Tue Mar 10 14:41:11 CET 2009

On Tue, Mar 10, 2009 at 02:29:46PM +0300, Igor Katson wrote:
> The problem is, that when I make a fifo, and send mplayer output to
> -ao pcm:file=fifo,
> and start encoding with oggenc, oggenc looks at the header
> and thinks that the file is only 1 hour length, though it is much more,
> and when an hour is encoded, oggenc just stops the process.

Well, the problem is that it is not possible to put more than one hour
of uncompressed data into wav, since wav specifies the size of the
data as 32 bit values (due to broken sign handling actually 31 bit).
One hour of data is already ca. 2 GB, and thus the limit for wav is
reached (not sure if there are ODML extensions for wav, but even then I
doubt oggenc would support them).
Now as to why FFmpeg works: It just sets all those size values to 0 at
the start, and oggenc obviously has special hacks to ignore that (if it
behaved "correctly" oggenc would not encode a single byte with FFmpeg).
Your options:
1) hack MPlayer, change libao2/ao_pcm.c the lines
>  wavhdr.data_length=le2me_32(0x7ffff000);
>  wavhdr.file_length = wavhdr.data_length + sizeof(wavhdr) - 8;
>  wavhdr.data_length=0;
>  wavhdr.file_length = 0;
this will most likely break other applications. You could also make a
patch so you can select which method ao_pcm uses.

2) use FFmpeg's wav writing method via mencoder, something like:
mencoder -oac pcm -novideo -of lavf -lavfopts format=wav -o -

3) use AIFF format, though you have to use mencoder for that, too:
mencoder -oac pcm -novideo -of lavf -lavfopts format=aiff -o -

More information about the MPlayer-users mailing list