Remove Audio From Video Using FFmpeg in Linux

This guide provides a straightforward overview of how to strip the audio track from a video file using FFmpeg in a Linux environment. You will learn the core command to discard audio while preserving video quality, how to handle batch processing for multiple files, and how to target specific audio tracks if a video contains more than one.

The Core Command

To remove all audio from a video file without re-encoding the video track, use the -an flag. This flag tells FFmpeg to disable audio recording in the output file.

ffmpeg -i input.mp4 -c:v copy -an output.mp4

Here is a breakdown of what each part of the command does:

Removing a Specific Audio Track

If your video file contains multiple audio tracks (such as different language options) and you only want to remove one while keeping the rest, you need to use advanced stream mapping instead of the -an flag.

First, identify the stream indexes by running ffmpeg -i input.mp4. Look for the stream identifiers, which usually look like 0:1 or 0:2.

Once you know the stream layout, you can use the -map flag to selectively include or exclude tracks. For example, to keep the video track (0:v) and the second audio track (0:a:1), but discard the first audio track (0:a:0), run:

ffmpeg -i input.mp4 -map 0:v -map 0:a:1 -c copy output.mp4

Batch Processing Multiple Files

If you have an entire directory of videos that need their audio removed, you can automate the process using a standard bash for loop in your Linux terminal.

The following script loops through all .mp4 files in the current directory and creates a new version prefixed with silent_:

for file in *.mp4; do
    ffmpeg -i "$file" -c:v copy -an "silent_$file"
done