Setting FLAC compression in FFmpeg

Software

The Free Lossless Audio Codec is supremely useful for archiving audio. You can compress audio using the flac tool, surprising though it may seem. This will compress it to the best size:

$ flac --best $SOURCE

But what if it can’t read the source? I’m trying really hard to avoid making one of my bad Tabasco puns I would have worked to death even a couple of years ago.

I previously batch-processed audio to aiff or wav first before feeding them in, before realising FFmpeg can transcode to flac in one step. And today I learned you can set an equivalent compression level:

$ ffmpeg -i $SOURCE -q:a flac -compression_level 12 $OUT.flac

I haven’t tested this on avconv, but I assume the same command would work.

Author bio and support

Me!

Ruben Schade is a technical writer and infrastructure architect in Sydney, Australia who refers to himself in the third person in bios. Hi!

The site is powered by Hugo, FreeBSD, and OpenZFS on OrionVM, everyone’s favourite bespoke cloud infrastructure provider.

If you found this post helpful or entertaining, you can shout me a coffee or send a comment. Thanks ☺️.