Brian Willoughby brianw at audiobanshee.com
Sun Dec 14 22:30:19 PST 2014

On Dec 14, 2014, at 5:23 PM, lvqcl <lvqcl.mail at gmail.com> wrote:
> Brian Willoughby wrote:
>>> Currently the header of a decoded WAV file can be different to the
>>> original WAV file because FLAC doesn't preserve 'fmt ' chunk.
>>> For example: create a 24-bit stereo .wav file with WAVEFORMATEXTENSIBLE
>>> header with channel mask == 3. Encode it to .flac then decode back to .wav.
>>> FLAC creates a 24-bit stereo .wav file with WAVEFORMATEX header.
>> Did you try this when using the FLAC command-line option --keep-foreign-metadata?
> Yes. I created a 24-bit stereo .wav file with SoX. It writes
> WAVEFORMATEXTENSIBLE 'fmt ' chunk and a 'fact' chunk. FLAC keeps
> 'fact' chunk but writes WAVEFORMATEX header.

Thanks for checking this out.

My vote: If --keep-foreign-metadata does not preserve the "header" of a RIFF/WAVE file (the header is actually a special chunk, 'fmt ', that does not always appear at the head of the file), then FLAC should be "fixed" so that this is also preserved when --keep-foreign-metadata is used. It should be as simple as saving the 'fmt ' chunk along with the others. If it's already being saved, then it should be even simpler to restore the "header" when decoding.

Brian Willoughby
Sound Consulting

More information about the flac-dev mailing list