Am I doing something wrong?

The command I ran was ffmpeg -i sample.mkv -acodec flac -vcodec copy flac.mkv

The original file had 16 bits DTS and the resulting FLAC 24 bits, and the file is +1 GB bigger, while everywhere I read says flac should be smaller than DTS.

What is the correct command to convert proprietary lossless formats to FLAC, while keeping the original settings and getting the smallest file size possible ?


FFmpeg's FLAC encoder defaults to 24 bits (padded and stored as 32).

Override it like this,

ffmpeg -i sample.mkv -acodec flac -sample_fmt s16 -vcodec copy flac.mkv
  • I don't understand much about this stuff. But won't that be bad for all other input that is not 16 bits? I would like something that just mirror the source settings ( bit depth, channels, etc ). Is there any benefit in 24 bits vs 16 ? – Freedo Jan 8 '18 at 6:40
  • If the source audio is 16 bits then there's no benefit to encoding it as 24 bits. Your input appears to be either >16 bits or 16-bits stored as 32-bit floating point, hence FLAC is selecting 24 bits output. – Gyan Jan 8 '18 at 6:56
  • And why the file size is higher while should be smaller than the DTS track? How can I make ffmpeg just use the input bit depth ? I want to use this command for other files too – Freedo Jan 8 '18 at 7:01
  • FLAC only supports two bit depths - 16 or 24 (stored as 32). If the input is 16 bit or lower, then 16 bit output is chosen, else 24 bit. So, your original command is fine. When the input is 16 bits but stored as 32 bits then ffmpeg will select 24 bits output. In which case, setting output sample depth, like in my answer, is needed to encode as 16 bits. – Gyan Jan 8 '18 at 7:13
  • 1
    For consumer use, 16 bit is good enough, regardless of source depth. – Gyan Jan 8 '18 at 7:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.