[flac-dev] Ogg Flac padding

Ian Nartowicz flac at nartowicz.co.uk
Thu May 15 09:54:10 PDT 2014


I've developed a function for updating Flac metadata blocks inside Ogg files.
Obviously it is desirable to use padding so that most edits don't require
rewriting massive files.

Although the flac encoder creates a padding metadata block by default in Ogg
Flac files, this appears to be useless.  When packets on an Ogg page change
size, the page size may change by as different amount, hence it is not possible
to offset changes in the size of one packet by changes in the size of a
different packet.

I have attempted to use standard Ogg packet padding (ie. a packet length longer
than the actual metadata block, filled with zeroes for safety) but libFLAC does
not understand this entirely legal format (actually it seems OK with it so
long as it is the last metadata page). I think it ignores the packet length as
declared by Ogg and just reads the bytes listed in the metablock header.

Further, libFLAC doesn't seem to understand when multiple metadata block
packets appear on the same page, aother legal arrangement, indeed the one that
is implied by the Ogg Flac mapping specification.

What can be done to support this format?

--ian


More information about the flac-dev mailing list