[flac-dev] Improvements to --keep-foreign-metadata (and testing)

Martijn van Beurden mvanb1 at gmail.com
Fri Feb 3 08:19:43 UTC 2023


Hi all,

Last year we had quite some discussion (for this mailinglist anyway)
about improvements to the --keep-foreign-metadata feature. I've had
some time to work on this, so there is a bunch of improvements ready
to be merged at https://github.com/xiph/flac/pull/543

All improvements are on decoding. They are:
- flac automatically picks the right output format from the stored
foreign metadata. Previously, if one had flac encode an AIFF file with
--keep-foreign-metadata, decoding would fail unless it was
specifically requested to decode to AIFF, as flac defaults to decode
to WAV. Now, flac will detect AIFF metadata is stored and decode to
AIFF without asking

- flac can now be forced to decode to WAVE_FORMAT_PCM,
WAVE_FORMAT_EXTENSIBLE, AIFF-C format NONE and AIFF-C format sowt.
This also benefits --keep-foreign-metadata. Before, AIFF-C files could
be converted to FLAC keeping foreign metadata, but restoring was not
possible, FLAC instead restored these files to plain AIFF.

- flac will now also verify the foreign metadata restoration after
decoding. This is beneficial, because flac only copies metadata it
doesn't understand, metadata directly concerning the audio (sample
rate, bit depth, number of channels) are generated from FLACs own
data. Also, the size of the audio chunk and the master chunk are
directly generated. With this patch, they are generated but verified
against what is stored, and the user is warned when they do not match.
With this, it can be detected that a FLAC file was changed (made
longer/shorter) without updating the foreign metadata.

>From my limited testing it seems these features work well, but I have
a limited set of test material. I would appreciate some help testing
it.

Kind regards, Martijn van Beurden


More information about the flac-dev mailing list