Trying to compress a 32 bit floating point waveform (raw binary). FLAC is out because it only goes up to 24 bits per sample. ALAC can handle 32 bits per sample.
I can encode directly from RAW to ALAC with the following command:
ffmpeg -f f32le -ar 4000 -ac 1 -i ts1.raw -acodec alac ts1.m4a
Note this works with any data file.
I have tried to set 32 bit sample size with -sample_fmt s32p
but it always prints the message:
[alac @ 0x55dbbcc98a00] encoding as 24 bits-per-sample
Decoding is done by:
ffmpeg -i ts1.m4a -f f32le -ar 4000 -ac 1 tsa.raw
I verify by loading the start and end raw files (ts1.raw
vs tsa.raw
) with Numpy (Python) and notice there is loss off precision. The result is closer to a 16 bit float but more precise (24 bit float makes sense). So basically I end up with a file containing 24 bit floats converted to 32 bit (lossy compression)!
How can I encode a 32 bits-per-sample lossless-compressed (for waveform data) file?