[Flac] Flac woes

Free Lunch freelunch at gmail.com
Sun Jun 10 07:04:58 PDT 2007


Howdy,

Flac-1.1.4 is refusing to encode some WAV files (amd64, gentoo):

% flac Song\ Name-Track01.wav
Song Name-Track01.wav: WARNING: legacy WAVE file has format type 1 but
bits-per-sample=24
Song Name-Track01.wav: 100% complete, ratio=0.546Song
Name-Track01.wav: ERROR during read of data pad byte

% sfinfo Song\ Name-Track01.wav
File Name      Song Name-Track01.wav
File Format    Microsoft RIFF WAVE Format (wave)
Data Format    24-bit integer (2's complement, little endian)
Audio Data     779761383 bytes begins at offset 44 (2c hex)
               1 channel, 259920461 frames
Sampling Rate  48000.00 Hz
Duration       5415.010 seconds

I did a search on the error message and found someone else with a
similar problem and Josh's reply said:

> but the wave file seems invalid.  sample data is supposed to be
> padded to an even number of bytes.

The gotcha here, as I have tried to explain in similar cases before,
is that we do not live in a perfect world.  Many of us record audio
and are unable to control whether a piece of hardware crashes and
leaves the end of a WAV perfectly aligned or padded.  In this case the
recorder (Alesis hd24) did not crash, it apparently just doesn't pad.
Since these are original audio masters being backed up, editing them
isn't a viable option.

The 'other cases' refers to situations where I am unable to use flac
on WAV files if the WAV header size is different than the actual file
size.  I had to write some fairly complex/kludgey scripts which (among
other tests) flac a file and then use metaflac to examine the size of
the archived file and if it does not exactly match the size of the
original WAV (minus header), discard the flac. Basically, a whole lot
of checking to make sure what is in the archive matches the original.
And very often it does not.

A bug was filed on that a couple years ago but apparently the fix
didn't make it into 1.1.4.  If the header says the WAV is only 50
bytes, then flac will only archive 50 bytes and will omit the rest of
a file.  Oh, your WAV was 1GB? Sorry, that audio is not part of the
archive. What, you deleted the WAV and only have the flac archive?
Well, I guess you should have noticed the message that indicated your
audio was being discarded:

WARNING: skipping unknown sub-chunk 'PAD '

Yep, that's all the warning you get when flac discards potentially
massive amounts of the original WAV simply because the header doesn't
match the contents.

It sure would be nice if the flac code made a greater effort to
archive the WAV, rather than partials.

Also, I get the legacy wave warning very frequently.  It isn't clear
what the issue is there?

All your effort on flac is greatly appreciated.. Sorry to bitch but
these are all pretty serious bugs for some of us who produce original
audio rather than just rip CD collections (never encountered these
bugs doing that), etc. I could try and kludge the flac code but I
doubt my hamfisted approach would pass muster.


Thanks!

  FL


More information about the Flac mailing list