[MPlayer-users] How to extract a .WAV file from part of a very long dump file
Alexander Roalter
alex at roalter.it
Wed Jun 6 15:54:03 CEST 2007
Martin McCormick wrote:
> I accidentally created an interesting problem. A shell script I
> wrote had a bug in it that caused me to dump about 35 hours of
> audio to a stream.dump file. I then discovered some material
> worth saving about 3 or 4 hours in to the stream. I thought I
> could maybe save the whole stream as a .wav file and I, in fact,
> could do that which ended up as a 20-gig .wav file.:-)
>
> I thought I might use sox to skip over the part of the
> file that wasn't worth saving and grab the little part that was,
> but a 20-gig file is too large for sox which complains about the
> size and aborts.
>
> I may be able this time to use split to break the
> stream.dump file off after the part I want to save which will
> considerably lessen the size of the .wav file I must then edit,
> but it brings up the question, is there a better way to edit a
> huge stream file?
>
> I did originally try to split the stream in to 1-hour
> segments, but there is apparently a header that must be there in
> order to play the segment. The first segment played fine but
> none of the others would.
>
> Thanks.
Assumed you make the cut on the exact location (i.e. after left and
right channel are output, you could use the resulting splitted file by
flagging it as raw pcm file, where no header is needed. Mplayer might be
able to play it, and there ought be some programs out there patching a
wav header to a raw wav file.
If you have 16bit stereo, there's only four different possibiltites you
can be off, and you should able to hear two of the erroneous quite easy,
if the upper byte of the left and the lower byte of the right channel
are mixed together and vice versa, if your boundary is off by 1 or 3
bytes. If it is only off by 2, left and right are swapped, and otherwise
everything should be ok.
It might still be an even lesser problem, if the wav header is a
multiple of 4, so you only have to cut at a position dividable by 4...
let's have a look into it...
Ok. it starts with RIFF (=4 bytes), then with the format chunk which is
4+4+2+4+4+2+2+2 = 24 bytes. Easy going, so just take care that you cut
at an address dividable by 4. And play it with a software able to play
raw PCM...
I know, I know, lots of repetitions in this post...
--
cheers,
Alex
More information about the MPlayer-users
mailing list