How can I convert a WAV file to an FLAC file with FFmpeg?

I need to make various files. One in 16 Bit, one in 24 bit, and one in 32 bit depth.

I also need to make different sample rates. E.g one in 176,400 kHz and one in 44,100 kHz.

I know FFmpeg -i input-file.wav output-file.flac will convert the file but I am not sure about the rest.

The FFmpeg documentation (https://www.ffmpeg.org/doxygen/2.1/flac_8h.html) is not very helpful with this.

1 Answer 1


FFmpeg's FLAC encoder supports sample bit depths of 16 and 24 bits, the latter padded to 32-bit. So for 24-bit, you will have to use a filter in-between.

ffmpeg -i in.wav -af aformat=s32:176000 out.flac

The above encodes to a 176 kHz 24-bit sample, stored as 32-bits. And the command below encodes to 16-bit and 44.1 kHz.

ffmpeg -i in.wav -af aformat=s16:44100 out.flac
  • 3
    For anyone reading this answer later, "16 and 24 bit samples" is referring to "Bit Depth", as opposed to "Bit Rate". "Bit Depth" is sometimes also referred to (By VLC for example) as "Bits per Sample".
    – Kelderic
    Mar 3, 2018 at 13:36
  • Thanks, with your help I was able to transform an MP3 that I got from YouTube to use it in a synthesizer that only allows files in 16 bits and 44.1 Khz
    – jlizanab
    Apr 23, 2021 at 18:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .