Creators and developers regularly tweak audio bitrate to balance quality and file size, whether for podcasts, music, or app assets. In community threads, a common question pops up when people ship to different platforms or optimize for bandwidth: how do you reliably change the bitrate and avoid re-encoding pitfalls?
I need to ship several audio variants for distribution and bandwidth testing. What’s the simplest, reliable way to change audio bitrate with FFmpeg? I’m targeting AAC and MP3, I want options for constant vs variable bitrate, and sometimes I need to keep the video track untouched while only re-encoding the audio. Also, how can I quickly verify the resulting bitrate and avoid quality losses from repeated transcoding?
FFmpeg makes audio bitrate changes straightforward once you pick a codec and strategy. All you need to do is re-encode the audio stream using the FFmpeg CLI.
- Bitrate is the amount of data per second, usually in kbps. Higher bitrate often means higher quality and larger files.
- CBR vs VBR: Constant bitrate aims for a fixed rate, while variable bitrate targets consistent perceptual quality.
- AAC is generally more efficient than MP3 at the same bitrate. To understand the differences for each format, check out AAC versus MP3.
Audio-only input to AAC at 128 kbps:
ffmpeg -i input.wav -c:a aac -b:a 128k output.m4a
Audio-only input to MP3 at 192 kbps:
ffmpeg -i input.wav -c:a libmp3lame -b:a 192k output.mp3
Keep the video track as-is and only re-encode audio to AAC 128 kbps:
ffmpeg -i input.mp4 -c:v copy -c:a aac -b:a 128k output.mp4
Use VBR for better efficiency when supported:
- AAC (native encoder, quality scale 1-5 roughly):
ffmpeg -i input.wav -c:a aac -q:a 2 output.m4a
- MP3 VBR with LAME (0 is highest quality, 2 is transparent for many cases):
ffmpeg -i input.wav -c:a libmp3lame -q:a 2 output.mp3
For voice content, downmix to mono and lower sample rate to save bandwidth:
ffmpeg -i interview.wav -ac 1 -ar 24000 -c:a aac -b:a 64k interview-64k-mono.m4a
# Bash example: convert all WAVs to 128 kbps AAC M4A
for f in *.wav; do
ffmpeg -y -i "$f" -c:a aac -b:a 128k "${f%.wav}.m4a"
doneCode language: PHP (php)
ffprobe -v error -select_streams a:0 \
-show_entries stream=codec_name,bit_rate,channels,sample_rate \
-of default=noprint_wrappers=1 output.m4aCode language: JavaScript (javascript)
- Lossy to lossy: Avoid multiple generations. Transcode from the best available source.
- Container fit: AAC pairs well with M4A or MP4; MP3 should use .mp3.
- If you are extracting audio from a video first, see this quick guide on FFmpeg audio extraction.
If you prefer not to run and scale FFmpeg yourself, you can upload your audio to Cloudinary and generate bitrate variants on upload or on demand. This is handy when you need multiple presets for speech, music, or platform-specific delivery, and you want CDN-backed URLs with caching.
A practical approach is to define named transformations (for example, mp3_128 and aac_64_mono) in your account, then create them automatically at upload time:
// Node.js example
const { v2: cloudinary } = require("cloudinary");
cloudinary.config({
cloud_name: "your_cloud",
api_key: "your_key",
api_secret: "your_secret"
});
async function uploadAndTranscode() {
await cloudinary.uploader.upload("voice.wav", {
resource_type: "video", // audio files use 'video' resource type
public_id: "voice_sample",
eager: [
{ transformation: "aac_64_mono" }, // named transformation you define
{ transformation: "mp3_128" }
]
});
}
uploadAndTranscode();Code language: JavaScript (javascript)
You can also deliver on the fly by requesting a named transformation in the URL, for example: https://res.cloudinary.com/your_cloud/video/upload/t_mp3_128/voice_sample.wav
- Change bitrate with FFmpeg using -b:a for target kbps or -q:a for VBR quality.
- Keep video unchanged while re-encoding audio using -c:v copy.
- Pick AAC for efficiency at lower bitrates and MP3 for broad compatibility.
- Verify results with ffprobe and avoid multi-generation lossy transcodes.
- For scalable delivery and multiple presets, generate variants through named transformations in a managed service.
Ready to streamline audio and video workflows with transformation presets and fast delivery? Sign up for Cloudinary free and start building.