Which audio encoders in FFmpeg support 8 kHz?Split audio feed using FFmpegffmpeg doesn't convert audioHow to encode and split an audio file in FFmpeg using asplitConcatenating multiple 24-bit 96 kHz wav audio files using ffmpeg, shntool, and soxRe-encode AC3 5.1 audio with variable bitrate using FFmpegBatch video convert with FFmpeg: combine image and audioFFMPEG merge two videos which don't have any audioCodec and setting for lowest bitrate ffmpeg outputFFmpeg skip audio filesffmpeg - Encode audio as list of samples
Does the on'yomi of 輪 (リン) have any relation to the English "ring", or is it a coincidence?
If I am just replacing the car engine, do I need to replace the odometer as well?
/etc/shadow permissions security best practice (000 vs. 600 vs. 640)
Creating cryptographic algorithms at runtime
Totally Blind Chess
Is Basalt Monolith a 1-card infinite combo with no payoff?
Is it possible to have a preference relation that is complete but not transitive?
Why is the air inside airliners so dry (low humidity)?
Is this bible in Koine Greek?
How to deal with a 6 year old who was "caught" cheating?
How can I prevent side-channel attacks against authentication?
Why did Google not use an NP problem for their quantum supremacy experiment?
Call local emergency number using a foreign mobile number
How to control the padding below a BarLegend?
How time is defined in astronomical science
Do any Star Trek characters play rock band instruments?
Is a turbocharged piston aircraft the same thing as turboprop?
Body swap, then building it back to health
Trying to find a short story about the representative of a city discovering the "primitive" folk are actually more advanced
Instant coffee melts like chocolate
Why does telnet on a non existent port not directly reject, but time out?
I was mistakenly identified as a criminal, and this has caused rumors. How can I convince my friends that it is all a mistake?
How did composers "test" their music?
Is the "Watchmen" TV series a continuation of the movie or the comics?
Which audio encoders in FFmpeg support 8 kHz?
Split audio feed using FFmpegffmpeg doesn't convert audioHow to encode and split an audio file in FFmpeg using asplitConcatenating multiple 24-bit 96 kHz wav audio files using ffmpeg, shntool, and soxRe-encode AC3 5.1 audio with variable bitrate using FFmpegBatch video convert with FFmpeg: combine image and audioFFMPEG merge two videos which don't have any audioCodec and setting for lowest bitrate ffmpeg outputFFmpeg skip audio filesffmpeg - Encode audio as list of samples
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty
margin-bottom:0;
I have an old video (made by a Casio Exilim EX-Z40, if it matters), whose audio stream ffprobe
reports as pcm_u8, 8000 Hz, mono, u8
.
I would like to transcode it into something modern.
Transcoding with FFmpeg defaults fails:
libfaac doesn't support this output format!
So presumably libfaac doesn't support 8 kHz, because -c:a copy
works.
Which encoders support an 8 kHz sampling rate?
The list found here barely mentions sampling rates at all.
Can I script something that tries every installed codec, from…
ffmpeg -codecs | grep EA`
…to see directly which ones work?
ffmpeg audio-conversion
add a comment
|
I have an old video (made by a Casio Exilim EX-Z40, if it matters), whose audio stream ffprobe
reports as pcm_u8, 8000 Hz, mono, u8
.
I would like to transcode it into something modern.
Transcoding with FFmpeg defaults fails:
libfaac doesn't support this output format!
So presumably libfaac doesn't support 8 kHz, because -c:a copy
works.
Which encoders support an 8 kHz sampling rate?
The list found here barely mentions sampling rates at all.
Can I script something that tries every installed codec, from…
ffmpeg -codecs | grep EA`
…to see directly which ones work?
ffmpeg audio-conversion
4
Do note that there's absolutely no reason you can't just pick a modern format with a higher sample rate, so that it will be playable by modern devices which expect a higher one. The compression will go a long ways from letting the file sizes get much larger than if you encoded at 8khz. It's not like a 32khz file will be four times larger, in other words.
– trlkly
Oct 15 at 8:03
Hmm. How about interpolating it up to 32kHz first?
– pjc50
Oct 15 at 8:58
add a comment
|
I have an old video (made by a Casio Exilim EX-Z40, if it matters), whose audio stream ffprobe
reports as pcm_u8, 8000 Hz, mono, u8
.
I would like to transcode it into something modern.
Transcoding with FFmpeg defaults fails:
libfaac doesn't support this output format!
So presumably libfaac doesn't support 8 kHz, because -c:a copy
works.
Which encoders support an 8 kHz sampling rate?
The list found here barely mentions sampling rates at all.
Can I script something that tries every installed codec, from…
ffmpeg -codecs | grep EA`
…to see directly which ones work?
ffmpeg audio-conversion
I have an old video (made by a Casio Exilim EX-Z40, if it matters), whose audio stream ffprobe
reports as pcm_u8, 8000 Hz, mono, u8
.
I would like to transcode it into something modern.
Transcoding with FFmpeg defaults fails:
libfaac doesn't support this output format!
So presumably libfaac doesn't support 8 kHz, because -c:a copy
works.
Which encoders support an 8 kHz sampling rate?
The list found here barely mentions sampling rates at all.
Can I script something that tries every installed codec, from…
ffmpeg -codecs | grep EA`
…to see directly which ones work?
ffmpeg audio-conversion
ffmpeg audio-conversion
edited Oct 14 at 17:31
JakeGould
36.2k10 gold badges114 silver badges155 bronze badges
36.2k10 gold badges114 silver badges155 bronze badges
asked Oct 14 at 17:21
Camille GoudeseuneCamille Goudeseune
9661 gold badge15 silver badges33 bronze badges
9661 gold badge15 silver badges33 bronze badges
4
Do note that there's absolutely no reason you can't just pick a modern format with a higher sample rate, so that it will be playable by modern devices which expect a higher one. The compression will go a long ways from letting the file sizes get much larger than if you encoded at 8khz. It's not like a 32khz file will be four times larger, in other words.
– trlkly
Oct 15 at 8:03
Hmm. How about interpolating it up to 32kHz first?
– pjc50
Oct 15 at 8:58
add a comment
|
4
Do note that there's absolutely no reason you can't just pick a modern format with a higher sample rate, so that it will be playable by modern devices which expect a higher one. The compression will go a long ways from letting the file sizes get much larger than if you encoded at 8khz. It's not like a 32khz file will be four times larger, in other words.
– trlkly
Oct 15 at 8:03
Hmm. How about interpolating it up to 32kHz first?
– pjc50
Oct 15 at 8:58
4
4
Do note that there's absolutely no reason you can't just pick a modern format with a higher sample rate, so that it will be playable by modern devices which expect a higher one. The compression will go a long ways from letting the file sizes get much larger than if you encoded at 8khz. It's not like a 32khz file will be four times larger, in other words.
– trlkly
Oct 15 at 8:03
Do note that there's absolutely no reason you can't just pick a modern format with a higher sample rate, so that it will be playable by modern devices which expect a higher one. The compression will go a long ways from letting the file sizes get much larger than if you encoded at 8khz. It's not like a 32khz file will be four times larger, in other words.
– trlkly
Oct 15 at 8:03
Hmm. How about interpolating it up to 32kHz first?
– pjc50
Oct 15 at 8:58
Hmm. How about interpolating it up to 32kHz first?
– pjc50
Oct 15 at 8:58
add a comment
|
4 Answers
4
active
oldest
votes
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.
1
Yes, that ffmpeg was years old. So I compiled afresh from today's git snapshot. Still, even at 8 kHz, ac3 and alac make files bigger than legacy pcm_u8; flac has problems playing in my 2 year old vlc; mp3 has horrible artifacts. But at least aac works and is slightly smaller, so I'll use that.
– Camille Goudeseune
Oct 14 at 19:21
5
FFMpeg's AAC compressor supports 8KHz, but many players don't. So by creating an 8KHz AAC you risk it being unplayable on many devices.
– Eugen Rieck
Oct 14 at 19:29
1
@CamilleGoudeseune Depending on where you need it to play, consider one of the high-efficiency codecs such as HE-AAC v1/v2. Or Opus as llogan suggested.
– Bob
Oct 15 at 7:10
Opus would be a better suggestion, where the top-quality encoder is the free open-source one, and it's good at low bitrate, especially for speech. FFmpeg's nativeaac
encoder is apparently ok, and sometimes beatslibfdk_aac
though. trac.ffmpeg.org/wiki/Encode/HighQualityAudio says that as of 2017,aac
is good, Oh, but @CamilleGoudeseune is using an old FFmpeg, and the nativeaac
encoder was much worse in older FFmpeg.
– Peter Cordes
Oct 15 at 15:15
Added an answer recommending Opus.
– Peter Cordes
Oct 15 at 16:14
add a comment
|
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
Good idea. But when I tried it, compared to the original, the file size increased and some high frequencies were attenuated. So, worse than-c:a copy
.
– Camille Goudeseune
Oct 14 at 17:32
3
No modern compressor is optimized for 8KHz sample rate, so everything modern will have difficulties with 8KHz audio. Depending on the output container format you want, you might or might not have the choice between different codecs. Please append your OQ or comment, then I can help you find the best possible version.
– Eugen Rieck
Oct 14 at 17:55
Yes, brute force testing of a bunch of modern compressors confirms that they suck at 8 kHz.
– Camille Goudeseune
Oct 14 at 19:23
add a comment
|
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.
add a comment
|
Opus is generally considered the best low-bitrate codec available, and doesn't have problems with an 8kHz input sample rate. The resulting opus stream can still be decoded to whatever sample rate is convenient for the decoder. (Like other lossy codecs, it compresses based on frequency bands after doing an FFT. But some other codecs apparently only want to decode to the same sample rate as the input. As other answers point out, you can get FFmpeg to resample the input before giving it to the codec, but you don't need that for Opus.
Try ffmpeg -c:a libopus -b:a 24k -frame_duration 120
for 24 kbit/s Opus.
Perhaps worth trying: -application voip
to tune for "improved speech intelligibility" instead of the default audio
profile.
Setting -frame_duration
to the highest value reduces overhead, I think. You don't care about encoder / decoder latency because you just have files, not real-time 2-way voice chat. So you can let it buffer 120ms of audio and pack together multiple CELT or SILK frames to reduce redundancy of frame headers.
The best available Opus encoder is the free and open source libopus
(https://opus-codec.org) so FFmpeg can just use it, unlike with AAC where the best encoders are closed-source.
Opus has special modes for very low bitrate speech (like 16kb/s), detecting speech and even switching over to a speech-specific encoder (SILK) at low bitrates.
Opus's low-bitrate coding tools are similar to what HE-AACv2 can do, see the wikipedia article.
But when I tried it, compared to the original, the file size increased ...
Part of the point of lossy compression is that you can choose the output bitrate, trading off against quality. Most codecs can use -b:a 32k
for example to choose an audio bitrate of 32 kbit/s.
(For video, you can also trade off CPU time spent encoding, e.g. -preset veryslow vs. -preset medium. But compressing audio is cheap enough that most codecs don't have a lot of options for spending more CPU time to improve the bitrate vs. quality tradeoff.)
Mono 8-bit 8kHz PCM has a bitrate of 64 kbit/s = 8 * 8000 so you're aiming for lower than that, otherwise you might as well keep your original files. PCM is just raw samples so bitrate is just a product of sample rate and sample width. Like the audio equivalent of a .bmp
bitmap image. That's highly inefficient, and the reason better codecs were invented. (And as you know from listening, saving bitrate for PCM comes at a massive cost to quality and frequency range because bitrate is tied 1:1 with sample rate.
That's not the case when you quantize in the frequency domain with a lossy codec.)
and some high frequencies were attenuated. So, worse than
-c:a copy
FFmpeg's native AAC encoder -c:a aac
used to be pretty bad, and you were using an old FFmpeg. https://trac.ffmpeg.org/wiki/Encode/HighQualityAudio says that as of 2017, aac
is sometimes better than libfdk_aac
for AAC-LC (low-complexity high bitrate). It doesn't mention HE-AAC, though, and that's what you want for low bitrate AAC.
libfdk_aac
used to be the best open-source AAC encoder available, and maybe still is for HE-AAC. AFAIK, neither of them are as good as the best non-free AAC encoders, though.
For low-bitrate AAC, you really want HE-AAC which adds more coding tools https://en.wikipedia.org/wiki/High-Efficiency_Advanced_Audio_Coding. I'm not sure if -c:a aac
can do that.
https://trac.ffmpeg.org/wiki/Encode/HighQualityAudio lists some recommended settings and ranges of useful bitrates for various encoders.
But you probably want Opus, or possibly AMR-NB (narrowband) for bitrates like 4 kbit/s. I don't know how old the quality vs. bitrate plot on the Opus wiki article is, but it shows AMR-NB at higher quality than Opus down below 8kb/s.
With that few bits, you might be able to understand speech but it won't sound nice. It's just a question of which codec is least horrible.
add a comment
|
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "3"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1492214%2fwhich-audio-encoders-in-ffmpeg-support-8-khz%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
4 Answers
4
active
oldest
votes
4 Answers
4
active
oldest
votes
active
oldest
votes
active
oldest
votes
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.
1
Yes, that ffmpeg was years old. So I compiled afresh from today's git snapshot. Still, even at 8 kHz, ac3 and alac make files bigger than legacy pcm_u8; flac has problems playing in my 2 year old vlc; mp3 has horrible artifacts. But at least aac works and is slightly smaller, so I'll use that.
– Camille Goudeseune
Oct 14 at 19:21
5
FFMpeg's AAC compressor supports 8KHz, but many players don't. So by creating an 8KHz AAC you risk it being unplayable on many devices.
– Eugen Rieck
Oct 14 at 19:29
1
@CamilleGoudeseune Depending on where you need it to play, consider one of the high-efficiency codecs such as HE-AAC v1/v2. Or Opus as llogan suggested.
– Bob
Oct 15 at 7:10
Opus would be a better suggestion, where the top-quality encoder is the free open-source one, and it's good at low bitrate, especially for speech. FFmpeg's nativeaac
encoder is apparently ok, and sometimes beatslibfdk_aac
though. trac.ffmpeg.org/wiki/Encode/HighQualityAudio says that as of 2017,aac
is good, Oh, but @CamilleGoudeseune is using an old FFmpeg, and the nativeaac
encoder was much worse in older FFmpeg.
– Peter Cordes
Oct 15 at 15:15
Added an answer recommending Opus.
– Peter Cordes
Oct 15 at 16:14
add a comment
|
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.
1
Yes, that ffmpeg was years old. So I compiled afresh from today's git snapshot. Still, even at 8 kHz, ac3 and alac make files bigger than legacy pcm_u8; flac has problems playing in my 2 year old vlc; mp3 has horrible artifacts. But at least aac works and is slightly smaller, so I'll use that.
– Camille Goudeseune
Oct 14 at 19:21
5
FFMpeg's AAC compressor supports 8KHz, but many players don't. So by creating an 8KHz AAC you risk it being unplayable on many devices.
– Eugen Rieck
Oct 14 at 19:29
1
@CamilleGoudeseune Depending on where you need it to play, consider one of the high-efficiency codecs such as HE-AAC v1/v2. Or Opus as llogan suggested.
– Bob
Oct 15 at 7:10
Opus would be a better suggestion, where the top-quality encoder is the free open-source one, and it's good at low bitrate, especially for speech. FFmpeg's nativeaac
encoder is apparently ok, and sometimes beatslibfdk_aac
though. trac.ffmpeg.org/wiki/Encode/HighQualityAudio says that as of 2017,aac
is good, Oh, but @CamilleGoudeseune is using an old FFmpeg, and the nativeaac
encoder was much worse in older FFmpeg.
– Peter Cordes
Oct 15 at 15:15
Added an answer recommending Opus.
– Peter Cordes
Oct 15 at 16:14
add a comment
|
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.
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.
edited Oct 14 at 19:19
answered Oct 14 at 17:58
lloganllogan
29.8k7 gold badges57 silver badges97 bronze badges
29.8k7 gold badges57 silver badges97 bronze badges
1
Yes, that ffmpeg was years old. So I compiled afresh from today's git snapshot. Still, even at 8 kHz, ac3 and alac make files bigger than legacy pcm_u8; flac has problems playing in my 2 year old vlc; mp3 has horrible artifacts. But at least aac works and is slightly smaller, so I'll use that.
– Camille Goudeseune
Oct 14 at 19:21
5
FFMpeg's AAC compressor supports 8KHz, but many players don't. So by creating an 8KHz AAC you risk it being unplayable on many devices.
– Eugen Rieck
Oct 14 at 19:29
1
@CamilleGoudeseune Depending on where you need it to play, consider one of the high-efficiency codecs such as HE-AAC v1/v2. Or Opus as llogan suggested.
– Bob
Oct 15 at 7:10
Opus would be a better suggestion, where the top-quality encoder is the free open-source one, and it's good at low bitrate, especially for speech. FFmpeg's nativeaac
encoder is apparently ok, and sometimes beatslibfdk_aac
though. trac.ffmpeg.org/wiki/Encode/HighQualityAudio says that as of 2017,aac
is good, Oh, but @CamilleGoudeseune is using an old FFmpeg, and the nativeaac
encoder was much worse in older FFmpeg.
– Peter Cordes
Oct 15 at 15:15
Added an answer recommending Opus.
– Peter Cordes
Oct 15 at 16:14
add a comment
|
1
Yes, that ffmpeg was years old. So I compiled afresh from today's git snapshot. Still, even at 8 kHz, ac3 and alac make files bigger than legacy pcm_u8; flac has problems playing in my 2 year old vlc; mp3 has horrible artifacts. But at least aac works and is slightly smaller, so I'll use that.
– Camille Goudeseune
Oct 14 at 19:21
5
FFMpeg's AAC compressor supports 8KHz, but many players don't. So by creating an 8KHz AAC you risk it being unplayable on many devices.
– Eugen Rieck
Oct 14 at 19:29
1
@CamilleGoudeseune Depending on where you need it to play, consider one of the high-efficiency codecs such as HE-AAC v1/v2. Or Opus as llogan suggested.
– Bob
Oct 15 at 7:10
Opus would be a better suggestion, where the top-quality encoder is the free open-source one, and it's good at low bitrate, especially for speech. FFmpeg's nativeaac
encoder is apparently ok, and sometimes beatslibfdk_aac
though. trac.ffmpeg.org/wiki/Encode/HighQualityAudio says that as of 2017,aac
is good, Oh, but @CamilleGoudeseune is using an old FFmpeg, and the nativeaac
encoder was much worse in older FFmpeg.
– Peter Cordes
Oct 15 at 15:15
Added an answer recommending Opus.
– Peter Cordes
Oct 15 at 16:14
1
1
Yes, that ffmpeg was years old. So I compiled afresh from today's git snapshot. Still, even at 8 kHz, ac3 and alac make files bigger than legacy pcm_u8; flac has problems playing in my 2 year old vlc; mp3 has horrible artifacts. But at least aac works and is slightly smaller, so I'll use that.
– Camille Goudeseune
Oct 14 at 19:21
Yes, that ffmpeg was years old. So I compiled afresh from today's git snapshot. Still, even at 8 kHz, ac3 and alac make files bigger than legacy pcm_u8; flac has problems playing in my 2 year old vlc; mp3 has horrible artifacts. But at least aac works and is slightly smaller, so I'll use that.
– Camille Goudeseune
Oct 14 at 19:21
5
5
FFMpeg's AAC compressor supports 8KHz, but many players don't. So by creating an 8KHz AAC you risk it being unplayable on many devices.
– Eugen Rieck
Oct 14 at 19:29
FFMpeg's AAC compressor supports 8KHz, but many players don't. So by creating an 8KHz AAC you risk it being unplayable on many devices.
– Eugen Rieck
Oct 14 at 19:29
1
1
@CamilleGoudeseune Depending on where you need it to play, consider one of the high-efficiency codecs such as HE-AAC v1/v2. Or Opus as llogan suggested.
– Bob
Oct 15 at 7:10
@CamilleGoudeseune Depending on where you need it to play, consider one of the high-efficiency codecs such as HE-AAC v1/v2. Or Opus as llogan suggested.
– Bob
Oct 15 at 7:10
Opus would be a better suggestion, where the top-quality encoder is the free open-source one, and it's good at low bitrate, especially for speech. FFmpeg's native
aac
encoder is apparently ok, and sometimes beats libfdk_aac
though. trac.ffmpeg.org/wiki/Encode/HighQualityAudio says that as of 2017, aac
is good, Oh, but @CamilleGoudeseune is using an old FFmpeg, and the native aac
encoder was much worse in older FFmpeg.– Peter Cordes
Oct 15 at 15:15
Opus would be a better suggestion, where the top-quality encoder is the free open-source one, and it's good at low bitrate, especially for speech. FFmpeg's native
aac
encoder is apparently ok, and sometimes beats libfdk_aac
though. trac.ffmpeg.org/wiki/Encode/HighQualityAudio says that as of 2017, aac
is good, Oh, but @CamilleGoudeseune is using an old FFmpeg, and the native aac
encoder was much worse in older FFmpeg.– Peter Cordes
Oct 15 at 15:15
Added an answer recommending Opus.
– Peter Cordes
Oct 15 at 16:14
Added an answer recommending Opus.
– Peter Cordes
Oct 15 at 16:14
add a comment
|
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
Good idea. But when I tried it, compared to the original, the file size increased and some high frequencies were attenuated. So, worse than-c:a copy
.
– Camille Goudeseune
Oct 14 at 17:32
3
No modern compressor is optimized for 8KHz sample rate, so everything modern will have difficulties with 8KHz audio. Depending on the output container format you want, you might or might not have the choice between different codecs. Please append your OQ or comment, then I can help you find the best possible version.
– Eugen Rieck
Oct 14 at 17:55
Yes, brute force testing of a bunch of modern compressors confirms that they suck at 8 kHz.
– Camille Goudeseune
Oct 14 at 19:23
add a comment
|
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
Good idea. But when I tried it, compared to the original, the file size increased and some high frequencies were attenuated. So, worse than-c:a copy
.
– Camille Goudeseune
Oct 14 at 17:32
3
No modern compressor is optimized for 8KHz sample rate, so everything modern will have difficulties with 8KHz audio. Depending on the output container format you want, you might or might not have the choice between different codecs. Please append your OQ or comment, then I can help you find the best possible version.
– Eugen Rieck
Oct 14 at 17:55
Yes, brute force testing of a bunch of modern compressors confirms that they suck at 8 kHz.
– Camille Goudeseune
Oct 14 at 19:23
add a comment
|
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
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
answered Oct 14 at 17:26
Eugen RieckEugen Rieck
13.1k2 gold badges28 silver badges33 bronze badges
13.1k2 gold badges28 silver badges33 bronze badges
Good idea. But when I tried it, compared to the original, the file size increased and some high frequencies were attenuated. So, worse than-c:a copy
.
– Camille Goudeseune
Oct 14 at 17:32
3
No modern compressor is optimized for 8KHz sample rate, so everything modern will have difficulties with 8KHz audio. Depending on the output container format you want, you might or might not have the choice between different codecs. Please append your OQ or comment, then I can help you find the best possible version.
– Eugen Rieck
Oct 14 at 17:55
Yes, brute force testing of a bunch of modern compressors confirms that they suck at 8 kHz.
– Camille Goudeseune
Oct 14 at 19:23
add a comment
|
Good idea. But when I tried it, compared to the original, the file size increased and some high frequencies were attenuated. So, worse than-c:a copy
.
– Camille Goudeseune
Oct 14 at 17:32
3
No modern compressor is optimized for 8KHz sample rate, so everything modern will have difficulties with 8KHz audio. Depending on the output container format you want, you might or might not have the choice between different codecs. Please append your OQ or comment, then I can help you find the best possible version.
– Eugen Rieck
Oct 14 at 17:55
Yes, brute force testing of a bunch of modern compressors confirms that they suck at 8 kHz.
– Camille Goudeseune
Oct 14 at 19:23
Good idea. But when I tried it, compared to the original, the file size increased and some high frequencies were attenuated. So, worse than
-c:a copy
.– Camille Goudeseune
Oct 14 at 17:32
Good idea. But when I tried it, compared to the original, the file size increased and some high frequencies were attenuated. So, worse than
-c:a copy
.– Camille Goudeseune
Oct 14 at 17:32
3
3
No modern compressor is optimized for 8KHz sample rate, so everything modern will have difficulties with 8KHz audio. Depending on the output container format you want, you might or might not have the choice between different codecs. Please append your OQ or comment, then I can help you find the best possible version.
– Eugen Rieck
Oct 14 at 17:55
No modern compressor is optimized for 8KHz sample rate, so everything modern will have difficulties with 8KHz audio. Depending on the output container format you want, you might or might not have the choice between different codecs. Please append your OQ or comment, then I can help you find the best possible version.
– Eugen Rieck
Oct 14 at 17:55
Yes, brute force testing of a bunch of modern compressors confirms that they suck at 8 kHz.
– Camille Goudeseune
Oct 14 at 19:23
Yes, brute force testing of a bunch of modern compressors confirms that they suck at 8 kHz.
– Camille Goudeseune
Oct 14 at 19:23
add a comment
|
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.
add a comment
|
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.
add a comment
|
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.
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.
answered Oct 15 at 13:09
RupRup
7821 gold badge11 silver badges17 bronze badges
7821 gold badge11 silver badges17 bronze badges
add a comment
|
add a comment
|
Opus is generally considered the best low-bitrate codec available, and doesn't have problems with an 8kHz input sample rate. The resulting opus stream can still be decoded to whatever sample rate is convenient for the decoder. (Like other lossy codecs, it compresses based on frequency bands after doing an FFT. But some other codecs apparently only want to decode to the same sample rate as the input. As other answers point out, you can get FFmpeg to resample the input before giving it to the codec, but you don't need that for Opus.
Try ffmpeg -c:a libopus -b:a 24k -frame_duration 120
for 24 kbit/s Opus.
Perhaps worth trying: -application voip
to tune for "improved speech intelligibility" instead of the default audio
profile.
Setting -frame_duration
to the highest value reduces overhead, I think. You don't care about encoder / decoder latency because you just have files, not real-time 2-way voice chat. So you can let it buffer 120ms of audio and pack together multiple CELT or SILK frames to reduce redundancy of frame headers.
The best available Opus encoder is the free and open source libopus
(https://opus-codec.org) so FFmpeg can just use it, unlike with AAC where the best encoders are closed-source.
Opus has special modes for very low bitrate speech (like 16kb/s), detecting speech and even switching over to a speech-specific encoder (SILK) at low bitrates.
Opus's low-bitrate coding tools are similar to what HE-AACv2 can do, see the wikipedia article.
But when I tried it, compared to the original, the file size increased ...
Part of the point of lossy compression is that you can choose the output bitrate, trading off against quality. Most codecs can use -b:a 32k
for example to choose an audio bitrate of 32 kbit/s.
(For video, you can also trade off CPU time spent encoding, e.g. -preset veryslow vs. -preset medium. But compressing audio is cheap enough that most codecs don't have a lot of options for spending more CPU time to improve the bitrate vs. quality tradeoff.)
Mono 8-bit 8kHz PCM has a bitrate of 64 kbit/s = 8 * 8000 so you're aiming for lower than that, otherwise you might as well keep your original files. PCM is just raw samples so bitrate is just a product of sample rate and sample width. Like the audio equivalent of a .bmp
bitmap image. That's highly inefficient, and the reason better codecs were invented. (And as you know from listening, saving bitrate for PCM comes at a massive cost to quality and frequency range because bitrate is tied 1:1 with sample rate.
That's not the case when you quantize in the frequency domain with a lossy codec.)
and some high frequencies were attenuated. So, worse than
-c:a copy
FFmpeg's native AAC encoder -c:a aac
used to be pretty bad, and you were using an old FFmpeg. https://trac.ffmpeg.org/wiki/Encode/HighQualityAudio says that as of 2017, aac
is sometimes better than libfdk_aac
for AAC-LC (low-complexity high bitrate). It doesn't mention HE-AAC, though, and that's what you want for low bitrate AAC.
libfdk_aac
used to be the best open-source AAC encoder available, and maybe still is for HE-AAC. AFAIK, neither of them are as good as the best non-free AAC encoders, though.
For low-bitrate AAC, you really want HE-AAC which adds more coding tools https://en.wikipedia.org/wiki/High-Efficiency_Advanced_Audio_Coding. I'm not sure if -c:a aac
can do that.
https://trac.ffmpeg.org/wiki/Encode/HighQualityAudio lists some recommended settings and ranges of useful bitrates for various encoders.
But you probably want Opus, or possibly AMR-NB (narrowband) for bitrates like 4 kbit/s. I don't know how old the quality vs. bitrate plot on the Opus wiki article is, but it shows AMR-NB at higher quality than Opus down below 8kb/s.
With that few bits, you might be able to understand speech but it won't sound nice. It's just a question of which codec is least horrible.
add a comment
|
Opus is generally considered the best low-bitrate codec available, and doesn't have problems with an 8kHz input sample rate. The resulting opus stream can still be decoded to whatever sample rate is convenient for the decoder. (Like other lossy codecs, it compresses based on frequency bands after doing an FFT. But some other codecs apparently only want to decode to the same sample rate as the input. As other answers point out, you can get FFmpeg to resample the input before giving it to the codec, but you don't need that for Opus.
Try ffmpeg -c:a libopus -b:a 24k -frame_duration 120
for 24 kbit/s Opus.
Perhaps worth trying: -application voip
to tune for "improved speech intelligibility" instead of the default audio
profile.
Setting -frame_duration
to the highest value reduces overhead, I think. You don't care about encoder / decoder latency because you just have files, not real-time 2-way voice chat. So you can let it buffer 120ms of audio and pack together multiple CELT or SILK frames to reduce redundancy of frame headers.
The best available Opus encoder is the free and open source libopus
(https://opus-codec.org) so FFmpeg can just use it, unlike with AAC where the best encoders are closed-source.
Opus has special modes for very low bitrate speech (like 16kb/s), detecting speech and even switching over to a speech-specific encoder (SILK) at low bitrates.
Opus's low-bitrate coding tools are similar to what HE-AACv2 can do, see the wikipedia article.
But when I tried it, compared to the original, the file size increased ...
Part of the point of lossy compression is that you can choose the output bitrate, trading off against quality. Most codecs can use -b:a 32k
for example to choose an audio bitrate of 32 kbit/s.
(For video, you can also trade off CPU time spent encoding, e.g. -preset veryslow vs. -preset medium. But compressing audio is cheap enough that most codecs don't have a lot of options for spending more CPU time to improve the bitrate vs. quality tradeoff.)
Mono 8-bit 8kHz PCM has a bitrate of 64 kbit/s = 8 * 8000 so you're aiming for lower than that, otherwise you might as well keep your original files. PCM is just raw samples so bitrate is just a product of sample rate and sample width. Like the audio equivalent of a .bmp
bitmap image. That's highly inefficient, and the reason better codecs were invented. (And as you know from listening, saving bitrate for PCM comes at a massive cost to quality and frequency range because bitrate is tied 1:1 with sample rate.
That's not the case when you quantize in the frequency domain with a lossy codec.)
and some high frequencies were attenuated. So, worse than
-c:a copy
FFmpeg's native AAC encoder -c:a aac
used to be pretty bad, and you were using an old FFmpeg. https://trac.ffmpeg.org/wiki/Encode/HighQualityAudio says that as of 2017, aac
is sometimes better than libfdk_aac
for AAC-LC (low-complexity high bitrate). It doesn't mention HE-AAC, though, and that's what you want for low bitrate AAC.
libfdk_aac
used to be the best open-source AAC encoder available, and maybe still is for HE-AAC. AFAIK, neither of them are as good as the best non-free AAC encoders, though.
For low-bitrate AAC, you really want HE-AAC which adds more coding tools https://en.wikipedia.org/wiki/High-Efficiency_Advanced_Audio_Coding. I'm not sure if -c:a aac
can do that.
https://trac.ffmpeg.org/wiki/Encode/HighQualityAudio lists some recommended settings and ranges of useful bitrates for various encoders.
But you probably want Opus, or possibly AMR-NB (narrowband) for bitrates like 4 kbit/s. I don't know how old the quality vs. bitrate plot on the Opus wiki article is, but it shows AMR-NB at higher quality than Opus down below 8kb/s.
With that few bits, you might be able to understand speech but it won't sound nice. It's just a question of which codec is least horrible.
add a comment
|
Opus is generally considered the best low-bitrate codec available, and doesn't have problems with an 8kHz input sample rate. The resulting opus stream can still be decoded to whatever sample rate is convenient for the decoder. (Like other lossy codecs, it compresses based on frequency bands after doing an FFT. But some other codecs apparently only want to decode to the same sample rate as the input. As other answers point out, you can get FFmpeg to resample the input before giving it to the codec, but you don't need that for Opus.
Try ffmpeg -c:a libopus -b:a 24k -frame_duration 120
for 24 kbit/s Opus.
Perhaps worth trying: -application voip
to tune for "improved speech intelligibility" instead of the default audio
profile.
Setting -frame_duration
to the highest value reduces overhead, I think. You don't care about encoder / decoder latency because you just have files, not real-time 2-way voice chat. So you can let it buffer 120ms of audio and pack together multiple CELT or SILK frames to reduce redundancy of frame headers.
The best available Opus encoder is the free and open source libopus
(https://opus-codec.org) so FFmpeg can just use it, unlike with AAC where the best encoders are closed-source.
Opus has special modes for very low bitrate speech (like 16kb/s), detecting speech and even switching over to a speech-specific encoder (SILK) at low bitrates.
Opus's low-bitrate coding tools are similar to what HE-AACv2 can do, see the wikipedia article.
But when I tried it, compared to the original, the file size increased ...
Part of the point of lossy compression is that you can choose the output bitrate, trading off against quality. Most codecs can use -b:a 32k
for example to choose an audio bitrate of 32 kbit/s.
(For video, you can also trade off CPU time spent encoding, e.g. -preset veryslow vs. -preset medium. But compressing audio is cheap enough that most codecs don't have a lot of options for spending more CPU time to improve the bitrate vs. quality tradeoff.)
Mono 8-bit 8kHz PCM has a bitrate of 64 kbit/s = 8 * 8000 so you're aiming for lower than that, otherwise you might as well keep your original files. PCM is just raw samples so bitrate is just a product of sample rate and sample width. Like the audio equivalent of a .bmp
bitmap image. That's highly inefficient, and the reason better codecs were invented. (And as you know from listening, saving bitrate for PCM comes at a massive cost to quality and frequency range because bitrate is tied 1:1 with sample rate.
That's not the case when you quantize in the frequency domain with a lossy codec.)
and some high frequencies were attenuated. So, worse than
-c:a copy
FFmpeg's native AAC encoder -c:a aac
used to be pretty bad, and you were using an old FFmpeg. https://trac.ffmpeg.org/wiki/Encode/HighQualityAudio says that as of 2017, aac
is sometimes better than libfdk_aac
for AAC-LC (low-complexity high bitrate). It doesn't mention HE-AAC, though, and that's what you want for low bitrate AAC.
libfdk_aac
used to be the best open-source AAC encoder available, and maybe still is for HE-AAC. AFAIK, neither of them are as good as the best non-free AAC encoders, though.
For low-bitrate AAC, you really want HE-AAC which adds more coding tools https://en.wikipedia.org/wiki/High-Efficiency_Advanced_Audio_Coding. I'm not sure if -c:a aac
can do that.
https://trac.ffmpeg.org/wiki/Encode/HighQualityAudio lists some recommended settings and ranges of useful bitrates for various encoders.
But you probably want Opus, or possibly AMR-NB (narrowband) for bitrates like 4 kbit/s. I don't know how old the quality vs. bitrate plot on the Opus wiki article is, but it shows AMR-NB at higher quality than Opus down below 8kb/s.
With that few bits, you might be able to understand speech but it won't sound nice. It's just a question of which codec is least horrible.
Opus is generally considered the best low-bitrate codec available, and doesn't have problems with an 8kHz input sample rate. The resulting opus stream can still be decoded to whatever sample rate is convenient for the decoder. (Like other lossy codecs, it compresses based on frequency bands after doing an FFT. But some other codecs apparently only want to decode to the same sample rate as the input. As other answers point out, you can get FFmpeg to resample the input before giving it to the codec, but you don't need that for Opus.
Try ffmpeg -c:a libopus -b:a 24k -frame_duration 120
for 24 kbit/s Opus.
Perhaps worth trying: -application voip
to tune for "improved speech intelligibility" instead of the default audio
profile.
Setting -frame_duration
to the highest value reduces overhead, I think. You don't care about encoder / decoder latency because you just have files, not real-time 2-way voice chat. So you can let it buffer 120ms of audio and pack together multiple CELT or SILK frames to reduce redundancy of frame headers.
The best available Opus encoder is the free and open source libopus
(https://opus-codec.org) so FFmpeg can just use it, unlike with AAC where the best encoders are closed-source.
Opus has special modes for very low bitrate speech (like 16kb/s), detecting speech and even switching over to a speech-specific encoder (SILK) at low bitrates.
Opus's low-bitrate coding tools are similar to what HE-AACv2 can do, see the wikipedia article.
But when I tried it, compared to the original, the file size increased ...
Part of the point of lossy compression is that you can choose the output bitrate, trading off against quality. Most codecs can use -b:a 32k
for example to choose an audio bitrate of 32 kbit/s.
(For video, you can also trade off CPU time spent encoding, e.g. -preset veryslow vs. -preset medium. But compressing audio is cheap enough that most codecs don't have a lot of options for spending more CPU time to improve the bitrate vs. quality tradeoff.)
Mono 8-bit 8kHz PCM has a bitrate of 64 kbit/s = 8 * 8000 so you're aiming for lower than that, otherwise you might as well keep your original files. PCM is just raw samples so bitrate is just a product of sample rate and sample width. Like the audio equivalent of a .bmp
bitmap image. That's highly inefficient, and the reason better codecs were invented. (And as you know from listening, saving bitrate for PCM comes at a massive cost to quality and frequency range because bitrate is tied 1:1 with sample rate.
That's not the case when you quantize in the frequency domain with a lossy codec.)
and some high frequencies were attenuated. So, worse than
-c:a copy
FFmpeg's native AAC encoder -c:a aac
used to be pretty bad, and you were using an old FFmpeg. https://trac.ffmpeg.org/wiki/Encode/HighQualityAudio says that as of 2017, aac
is sometimes better than libfdk_aac
for AAC-LC (low-complexity high bitrate). It doesn't mention HE-AAC, though, and that's what you want for low bitrate AAC.
libfdk_aac
used to be the best open-source AAC encoder available, and maybe still is for HE-AAC. AFAIK, neither of them are as good as the best non-free AAC encoders, though.
For low-bitrate AAC, you really want HE-AAC which adds more coding tools https://en.wikipedia.org/wiki/High-Efficiency_Advanced_Audio_Coding. I'm not sure if -c:a aac
can do that.
https://trac.ffmpeg.org/wiki/Encode/HighQualityAudio lists some recommended settings and ranges of useful bitrates for various encoders.
But you probably want Opus, or possibly AMR-NB (narrowband) for bitrates like 4 kbit/s. I don't know how old the quality vs. bitrate plot on the Opus wiki article is, but it shows AMR-NB at higher quality than Opus down below 8kb/s.
With that few bits, you might be able to understand speech but it won't sound nice. It's just a question of which codec is least horrible.
edited Oct 15 at 22:03
answered Oct 15 at 16:11
Peter CordesPeter Cordes
3,07317 silver badges24 bronze badges
3,07317 silver badges24 bronze badges
add a comment
|
add a comment
|
Thanks for contributing an answer to Super User!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1492214%2fwhich-audio-encoders-in-ffmpeg-support-8-khz%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
4
Do note that there's absolutely no reason you can't just pick a modern format with a higher sample rate, so that it will be playable by modern devices which expect a higher one. The compression will go a long ways from letting the file sizes get much larger than if you encoded at 8khz. It's not like a 32khz file will be four times larger, in other words.
– trlkly
Oct 15 at 8:03
Hmm. How about interpolating it up to 32kHz first?
– pjc50
Oct 15 at 8:58