[LAU] Adventures in concatenating ogg files

From: Ken Restivo <ken@email-addr-hidden>
Date: Wed Nov 19 2014 - 04:02:54 EET

I've for months now been struggling (like Don Quixote, it appears) to find a way to RELIABLY, and with tolerance of any kind of error, concatenate several Ogg Vorbis files-- some with multiple streams in them-- into one.

At first I was trying to do it without decoding. Wrote a bunch of tools in several languages attempting to do that. None of them worked for all cases (some worked for a few, some worked for none).

The existing tools out there-- sox, mplayer, ffmpeg-- all require decoding/re-encoding, but even with that they failed on various edge cases (multiple streams in a file, streams with zero audio data, empty files, etc).

I finally ended up with the only thing that sort of worked and handled ALL the edge cases, even though it requires decoding and recoding audio, which wastes CPU and also might introduce artifacts, which was this magical pipeline:

 ogg123 --audio-buffer 0 -q -d wav -f - files-to-concat/*ogg | oggenc -Q - > total-file.ogg

Except for one problem.

Any shows longer than 3:22:53 get concatenated to 3:22:53. What's special about that number? Oh, I bet it is a size_t overflow in probably the total number of decoded bytes at 44.1khz.

If my math is correct, 44.1khz, 2 channels, 16 bits, 3:22:53 is 2,147,317,200 bytes. Ding.

Now what? Go digging through the source of ogg123 or oggenc looking for the problem, and try to patch it?

Ogg Vorbis has been a released standard since, what, 2000? Is it possible in 2014 that I'm the only person who has ever run into this problem?

-ken

 
_______________________________________________
Linux-audio-user mailing list
Linux-audio-user@email-addr-hidden
http://lists.linuxaudio.org/listinfo/linux-audio-user
Received on Wed Nov 19 04:15:02 2014

This archive was generated by hypermail 2.1.8 : Wed Nov 19 2014 - 04:15:02 EET