Lossless conversion from wav 24bits to flac

0

Is it possible to have a lossless conversion from a wav file Stream #0:0: Audio: pcm_s24le ([1][0][0][0] / 0x0001), 48000 Hz, 1 channels, s32, 1152 kb/s to a wav file ?

I tried using ffmpeg : ffmpeg -y -i KEEP_01.wav -acodec flac output.flac but i get this warning : Conversion will not be lossless. Incompatible sample format 's32' for codec 'flac', auto-selecting format 's16'

I also used sox but i had no warning so i don't know if the conversion was lossless or not.

Also i don't really understand the difference between sample_format and bits_per_sample in my ffprobe output :

"streams": [ { "index": 0, "codec_name": "pcm_s24le", "codec_long_name": "PCM signed 24-bit little-endian", "codec_type": "audio", "codec_time_base": "1/48000", "codec_tag_string": "[1][0][0][0]", "codec_tag": "0x0001", "sample_fmt": "s32", "sample_rate": "48000", "channels": 1, "bits_per_sample": 24, "r_frame_rate": "0/0", "avg_frame_rate": "0/0", "time_base": "1/48000", "duration": "0.810667", "bit_rate": "1152000" } ]

Narthe

Posted 2017-03-22T18:56:05.193

Reputation: 121

The FLAC format is able to provide a representation for your sample. It's just a question of finding the right tool. Have you considered VLC?

– Run CMD – 2017-03-22T19:10:18.033

No i didn't considered VLC, can i do the same thing with it ? – Narthe – 2017-03-22T19:35:35.710

Answers

1

I realised I was using an old version of ffmpeg.

I tested with a more recent one and it worked fine.

Narthe

Posted 2017-03-22T18:56:05.193

Reputation: 121

That comment adds a lot more questions. – None – 2017-03-23T14:43:32.133

@FleetCommand How so? That's what solved the OP's problem; there was some bug or unsupported feature in an old version. – slhck – 2017-03-23T15:31:53.083

@slhck This answer is written by the OP! Hence, I imagine there is nothing unclear to him. – None – 2017-03-23T15:58:31.140

@FleetCommand You said “That comment adds a lot more questions” – I don't understand how. This is not a comment; it's a post in which the OP is answering their own question. – slhck – 2017-03-24T11:58:17.317

0

Your PCM is 24-bit samples in a 32-bit store, but the WAV doesn't seem to have flagged that correctly.

Try these two steps:

ffmpeg -i KEEP_01.wav -c copy out.wav

ffmpeg -i out.wav output.flac

FFmpeg's FLAC encoder only encodes to 16 or 24-bit sample formats. The latter is stored as 32-bit, just like your input.

Gyan

Posted 2017-03-22T18:56:05.193

Reputation: 21 016

Same warning with this additional option. Do you think my original wav file is badly encoded ? – Narthe – 2017-03-22T19:33:37.527

Try edited cmds. – Gyan – 2017-03-22T19:35:29.400

Same warning =P – Narthe – 2017-03-22T19:38:05.540

Upload a small portion of the WAV. – Gyan – 2017-03-22T19:38:43.537

https://www.dropbox.com/s/g0tqm8estxk55nm/in.wav?dl=1 – Narthe – 2017-03-22T20:28:41.450

Converts fine with your original command. Did a MD5 compare on the decoded FLAC with the PCM. https://www.datafilehost.com/d/65c6855f Upgrade your ffmpeg.

– Gyan – 2017-03-22T20:47:55.907

Using a more recent version of ffmpeg did the trick. I was trusting our IT department and using a ffmpeg build from 2012 that was in a folder called "ffmpeg-latest". Anyway, thanks ! – Narthe – 2017-03-22T20:58:33.367

Should i delete my post or tag it as resolved since the issue isn't really relevant ? – Narthe – 2017-03-22T21:02:14.683

Keep it. May help others encountering the same error. – Gyan – 2017-03-22T21:11:10.473

@Narthe You should answer your own question by clicking the button below. Also, next time, please include the full, uncut command line output in your question, so troubleshooting becomes easier for others. – slhck – 2017-03-23T07:38:01.873