> audio
Everything that touches the audio track of a media file: pulling audio out of a video, stripping or swapping the soundtrack, changing gain, resampling, and hitting broadcast loudness targets. These are the commands you reach for when the picture is fine but the sound is too quiet, too loud, in the wrong format, or in the way.
// audio
7 commands$ ffmpeg -i input.mp4 -vn -acodec copy audio.aac$ ffmpeg -i input.mp4 -an -c:v copy output.mp4$ ffmpeg -i input.mp4 -i audio.mp3 -c:v copy -c:a aac -map 0:v:0 -map 1:a:0 output.mp4$ ffmpeg -i input.mp4 -af "volume=2.0" output.mp4$ ffmpeg -i input.mp4 -af loudnorm=I=-16:TP=-1.5:LRA=11 output.mp4$ ffmpeg -i audio.mp3 -ar 44100 output.mp3$ ffmpeg -i input.mp4 -af "volume=enable='between(t,5,10)':volume=0" output.mp4// faq
How do I extract audio from a video without re-encoding it?
Use -vn to drop the video and -c:a copy (a.k.a. -acodec copy) to stream-copy the audio untouched. The output extension must match the source codec (AAC in MP4 goes to .aac, not .mp3); to actually change format you must re-encode instead, e.g. -c:a libmp3lame.
Why is my audio cut off or the video runs silent after I replace the soundtrack?
By default ffmpeg keeps encoding until the longest mapped stream ends, so a shorter track leaves the other stream running past it. Add -shortest to end output when the shorter of the two streams finishes.
How do I normalize audio to a consistent loudness for YouTube or a podcast?
Use the loudnorm filter with an EBU R128 target such as -af loudnorm=I=-16:TP=-1.5:LRA=11 (-16 LUFS integrated is a common streaming target). For accurate results run it two-pass: measure with print_format=json first, then pass those measured values into the second run.