Which audio encoders in FFmpeg support 8 kHz?
The native FFmpeg AAC encoder (-c:a aac
) supports 8000 Hz sample rate:
ffmpeg -h encoder=aac
...
Supported sample rates: 96000 88200 64000 48000 44100 32000 24000 22050 16000 12000 11025 8000 7350
It will automatically choose the sample rate the most closely matches the input, so you don't need to declare -ar
:
ffmpeg -i input.mov -c:a aac output.m4a
Which audio encoders in FFmpeg support 8 kHz?
aac, aptx, aptx_hd, dca, flac, g723_1, libfdk_aac, libmp3lame, libopus, libspeex, libvorbis, real_144, wavpack, many pcm variants.
There are probably others, but reporting of supported_samplerates
is inconsistent.
I would like to transcode it into something modern.
libfaac has been removed from FFmpeg for years and is not considered to be a modern AAC encoder. Your ffmpeg
must be ancient. Update and use the native FFmpeg AAC encoder, or compile and use libfdk_aac
.
If you want the most modern use libopus
.
But when I tried [aac], compared to the original, the file size increased and some high frequencies were attenuated.
Since I suspect your ffmpeg
is very old you are likely missing the major quality updates to the encoder aac
. Upgrade and quality will likely improve.
Sampling rate and codec are different parameters. Most likely you want something along the lines of
-ar 48000 -c:a aac
To upsample from 8KHz to 48KHz and the compress to AAC
8 KHz is fairly standard for speech, known as 'narrow band'. If this is speech then you should have plenty of options, although not that many are supported by FFmpeg out-of-the-box. Probably the best options are
- AMR - you can compile libopencode-amrnb into FFmpeg for support
- Opus, which will use the Vorbis CELT speech codec
However 8KHz 8-bit PCM isn't a very good source in the first place: most encoders will expect / hope for better input, e.g. 8-bit G.711 mu-law which is effectively 12-bit data encoded as 8-bit floating point. They may not do well with pure 8-bit PCM input as it might not fit speech patterns they're modelled for.
It's also a fairly small file already, and it's possible that your video container won't support more complicated codecs. So I think this is more trouble than it's worth, and I'd leave the audio as-is.