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

Conrad Parker conrad at metadecks.org
Thu Jun 18 12:15:38 PDT 2009


2009/6/18 Adam Rosi-Kessel <adam at rosi-kessel.org>:
> On Thu, Jun 18, 2009 at 11:12:30PM +0900, Conrad Parker wrote:
>> yow, that's pretty badly corrupted, the vorbis codebooks (usually the
>> third packet) is completely gone. It looks like you'd need to throw
>> away the first 16 packets, start with fresh headers, and copy in the
>> rest of the data (packet by packet, or page by page?)
>
> Maybe the metadata writer somehow spilled over the second packet into the
> third? In any case, is this something I can do myself -- insert fresh
> headers, and then start with packetno 17? I tried doing this with the
> oggz-dump trick, and the resulting file validated but wouldn't play. I
> tried running the resulting file through the various other tools
> (oggz-sort, hogg reconstruct) with no luck.

2009/6/19 ogg.k.ogg.k at googlemail.com <ogg.k.ogg.k at googlemail.com>:
> FWIW, yesterday I tried to dump the file, and replace the comments
> and codebooks packets with some the ones from a known good file,
> and dump -r it, but since you say dump -r doesn't preserve segmentation
> (not sure what you meant there), that might be why it did not work. I
> also don't know how much the codebooks header would change between
> files, I didn't try to work out which rate/channels/etc to match with a
> codebooks packet from a matching stream.

oggz-dump -r will at least create an Ogg file with the desired
packets, and it's good that that at least validated. By "not
preserving segmentation" I meant that it won't respect the page
boundaries of the original file -- but now I see that that doesn't
matter here, as the issue is really that the packet data is corrupted.

Hopefully at some point the vorbis data in the file becomes valid.
Perhaps we just need to know the original encoding settings to create
a new file with valid codebooks and splice them together: oggz-dump -r
should be ok for that, just take the first 3 packets of the new file,
and packets 17 onwards (or 100 onwards) of the original file ...

vi is a great audio editor ;-)

Conrad.


More information about the ogg-dev mailing list