[ogg-dev] Fixing ogg vorbis corruption caused by bad metadata

ogg.k.ogg.k at googlemail.com ogg.k.ogg.k at googlemail.com
Tue Jul 14 04:16:49 PDT 2009


> So if I understand correctly -- the first packet is just OggS, so that's

No. The first packet is the ID header, containing information such as
bitrate, sample rate, number of channels, etc. OggS is the ogg level
page capture pattern. Pages encapsulate packets.

> easy to replace. The second packet is the metadata, which we can lose.
> It's just the third packet that needs to be reconstructed. After that,
> you could start at any packet division in the rest of the file and it
> would play fine? So this generic restore tool that I'm positing would
> just need to try every known codebook set until a valid file was
> produced? How hard would that be?

You'd need to renumber and regenerate CRCs. rogg might do all that
(a set of tools somewhere on svn.xiph.org).

> What I'm puzzled by, based on the information above, is why my attempted
> fixes haven't worked: pick a valid ogg vorbis file that I believe was
> ripped with the same tool around the same time, swap in the first three
> packets from that file, modify the serial number to match the new file.
> Thus far this technique hasn't actually fixed any files.

CRCs ? If they're wrong (and they'd become wrong if you fiddle with the
serial number without regenerating them), libogg will ignore the page.


More information about the ogg-dev mailing list