The option is -compression_level
and can be set with either avconv
or FFmpeg
:
ffmpeg -i input.wav -c:a flac -compression_level 12 output.flac
Interestingly enough the commandline flac encoder offers compression levels of 0-8 but FFmpeg / avconv offers 0-12. The documentation can be seen in 3 places:
1. Source code:
The options for flac compression can be seen in flacenc.c
:
/* set compression option defaults based on avctx->compression_level */
if (avctx->compression_level < 0) <-------------
s->options.compression_level = 5; <-------------
else
s->options.compression_level = avctx->compression_level;
level = s->options.compression_level;
if (level > 12) { <-------------
av_log(avctx, AV_LOG_ERROR, "invalid compression level: %d\n",
s->options.compression_level);
return AVERROR(EINVAL);
}
I have 'arrowed' in the relevant sections!
2. Man pages:
The compression options can also be seen in man ffmpeg-all
rather than man ffmpeg
:). This man page shows:
compression_level
Sets the compression level, which chooses defaults for many other options
if they are not set explicitly. Valid values are from 0 to 12, 5 is the default.
A little confusing with multiple man pages now available for FFmpeg!
3. Online documentation:
As 'Miso Soup' pointed out there is also some documentation available online for the deeper options of flac encoding, including the compression options:
compression_level
Sets the compression level, which chooses defaults for many
other options if they are not set explicitly. Valid values
are from 0 to 12, 5 is the default.
Same as the man pages but perhaps a little easier for some to find and read!
References: