can't encode a WAV file to FLAC; returns 'ERROR: unsupported format type 3'

The error reportedly originates from files created on Windows. When attempting to convert, flac 1.4.3 prints:

$ flac --best ~/music/unknown-80s-german-song.wav
unknown-80s-german-song.wav: ERROR: unsupported format type 3

I opened the file in Audacity 3.4.2 (Flatpak) and attempted exporting — the program defaults to ‘signed 16-bit PCM’ encoding while the file presents itself as 32-bit:

$ mediainfo ~/music/unknown-80s-german-song.wav
General
Complete name                            : /home/user/music/unknown-80s-german-song.wav
Format                                   : Wave
Format settings                          : PcmWaveformat
File size                                : 60.6 MiB
Duration                                 : 2 min 59 s
Overall bit rate mode                    : Constant
Overall bit rate                         : 2 822 kb/s

Audio
Format                                   : PCM
Format profile                           : Float
Codec ID                                 : 3
Codec ID/Hint                            : IEEE 
Duration                                 : 2 min 59 s
Bit rate mode                            : Constant
Bit rate                                 : 2 822 kb/s
Channel(s)                               : 2 channels
Sampling rate                            : 44.1 kHz
Bit depth                                : 32 bits
Stream size                              : 60.6 MiB (100%)

For automation I prefer a command-line method.


While this is on the grey area (the state of copyright = unknown), the file emerged on a community centered around a certain unidentified song (digitized tape).

Asked By: user598527

||

ERROR: unsupported format type 3

Type 3 is associated to the WAVE_FORMAT_IEEE_FLOAT wave format.

#define WAVE_FORMAT_IEEE_FLOAT          (0x0003U)

So you are asking flac to encode a floating point encoded .wav when, as far as stated, flac does not (yet?) support that :

FLAC can now encode and decode 32 bit-per-sample audio… Note that
this is 32 bit integer samples, not 32 bit float samples
.

You should be able to convert the samples to 32 bits integers from the command-line using sndfile-convert from the quasi-standard libsndfile. Something like

sndfile-convert -pcm32 ~/music/unknown-80s-german-song.wav converted_result

Note that 32 bits float using a 24 bits mantissa, it should in fact result in a 24 bits per sample file.

Also note that sndfile-convert appears from the doc capable to output in flac format in the same go by specifying the .flac extension to the name of the output file. (I did not test that though)


OP’s experience returns that sndfile-convert does not appear capable to achieve both conversions in the same go, something sox should be capable of according to Austin Hemelgarn

sox ~/music/unknown-80s-german-song.wav -t flac -e signed-integer -b 24 -C 8 ~/music/unknown-80s-german-song.flac

should convert floating-point samples to 24 bits signed integers and convert to flac with a compression factor of 8 in the same go.

Answered By: MC68020
Categories: Answers Tags: , , , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.