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

Adam Rosi-Kessel adam at rosi-kessel.org
Thu Jun 18 12:44:30 PDT 2009

Adam Rosi-Kessel wrote, on 6/18/2009 3:35 PM:
> Conrad Parker wrote, on 6/18/2009 3:15 PM:
>> 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 ...
> Is there some magic to the codebooks? Do I need to find something ripped
> with exactly the same settings (e.g. quality level) and/or the same
> ripper? Or will any ogg vorbis file work?
> I tried this with a good file with the same libvorbis string as the
> corrupted file -- "libVorbis I 20050304" -- suggesting, I think, that I
> ripped it around the same time and probably using the same tool with the
> same settings. No luck. oggz-validate 0.9.9 reports serialno "Terminal
> header page has non-zero granulepos." It also plays silently.
> Even taking out the 100 packets, same result. Or swapping in the first
> 100 packets from the "good" file in place of the 100 packets from the
> "bad" file (fixing serialnos of course).
> What is the meaning of "terminal header page has non-zero granulepos"?
> Is that actually the clue to fix it?

Actually, this seems to be a problem with the oggz-dump method:

# oggz-validate in.ogg
# oggz-dump in.ogg | oggz-dump -o out.ogg -r -
# oggz-validate out.ogg
out.ogg: Error:
serialno 1404133069: Terminal header page has non-zero granulepos

So just running it back and forth through oggz-dump generates that error.

More information about the ogg-dev mailing list