How do I change the bit depth in FFmpeg?
Solution 1:
By default, the FFmpeg FLAC encoder takes the bit depth of the original. The bit depth can be changed with the sample_fmt
option, e.g.
ffmpeg -i … -c:a flac -sample_fmt s16 output.flac
Note that not all formats are supported by every encoder.
For a list of all supported sample formats, run:
ffmpeg -sample_fmts
See the chapter Audio Options in the FFmpeg command line documentation.
Solution 2:
To reduce bit depth to 16 with dithering:
ffmpeg -i input.flac -acodec flac -af aresample=osf=s16:dither_method=triangular_hp output.flac
See e.g. https://www.waves.com/audio-dithering-what-you-need-to-know