How to set sample format when using sox with ffmpeg?

1000 Views Asked by At

I am trying to convert a 44.1k 16bit flac file into 48k 32 bit (float) wav file.

This is the command I use:

'ffmpeg -i in.flac -af aresample=resampler=soxr:precision=28:out_sample_fmt=fltp:out_sample_rate=48000 out.wav'

No matter which value I use for out_sample_fmt like s32, flt, fltp the output out.wav is only 16 bit.

What am I doing wrong here? How to get the highest quality (as in resampling) 32 bit floating point wav file with ffmpeg using soxr?

1

There are 1 best solutions below

0
Gyan On BEST ANSWER

The issue isn't with soxr or aresample. Typically, after media data is filtered, it is encoded before being written to output. For each output format, there is a default encoder designated for each type of stream (audio, video..). In case of WAV, it's pcm_s16le for audio.

Add -c:a pcm_f32le for 32-bit floating point PCM, in little-endian order. Change le to be for big-endian.