[MPlayer-dev-eng] [PATCH] Speedup for pcm/wav audio dump
Robert Kesterson
robertk at robertk.com
Fri Feb 1 22:34:54 CET 2002
On my system, the 4096-byte burst size in the pcm/wav audio output causes
audio dumping to be unbearably slow (several minutes to dump just a few
seconds of audio on a 1.4 GHz Athlon). Increasing the burst size solves
the problem -- with a caveat. You *must* be using the "-ni" option or
you'll get "too many video packets" error and a premature exit. However,
with the "-ni" option in place, an entire two-hour movie audio can be
dumed to wav in just a few minutes.
Here is a patch to ao_pcm.c that increases the burst size to 1 meg. It
also writes the wav header (if appropriate) first before writing the file,
then comes back and fills it in later. (This lets you play the wav file
while it's still dumping so you can verify it's what you want. It also
lets you set up a fifo on audiodump.wav so you can pump the output
directly to a conversion / encoding tool without needing the wav file.)
(I'm trying to follow the DOCS/tech/patches.txt guidelines, so someone
please correct me if I missed something.)
--
Robert Kesterson
robertk at robertk.com
-------------- next part --------------
Index: ao_pcm.c
===================================================================
RCS file: /cvsroot/mplayer/main/libao2/ao_pcm.c,v
retrieving revision 1.4
diff -u -r1.4 ao_pcm.c
--- ao_pcm.c 24 Nov 2001 05:21:22 -0000 1.4
+++ ao_pcm.c 1 Feb 2002 21:32:31 -0000
@@ -82,12 +82,13 @@
printf("PCM: Info - to write WAVE files use -waveheader (default), for RAW PCM -nowaveheader.\n");
fp = fopen(ao_outputfilename, "wb");
- ao_data.outburst = 4096;
+ ao_data.outburst = 1024*1024; // 4096;
if(fp) {
- if(ao_pcm_waveheader) /* Reserve space for wave header */
- fseek(fp, sizeof(wavhdr), SEEK_SET);
+ fwrite(&wavhdr, 1, sizeof(wavhdr), fp);
+ // if(ao_pcm_waveheader) /* Reserve space for wave header */
+ // fseek(fp, sizeof(wavhdr), SEEK_SET);
return 1;
}
printf("PCM: Failed to open %s for writing!\n", ao_outputfilename);
More information about the MPlayer-dev-eng
mailing list