FFmpeg Map Only English Audio Tracks from MKV
This article explains how to use FFmpeg to select and keep only the English audio tracks from an MKV file containing multiple language tracks. By utilizing FFmpeg’s stream specifiers and metadata filtering, you can extract the video and only the English audio without re-encoding the streams, preserving the original quality while saving file space.
The Basic Command
To map only the English audio tracks along with the original video (and optional subtitles), use the following FFmpeg command:
ffmpeg -i input.mkv -map 0:v -map 0:a:m:language:eng -map 0:s? -c copy output.mkvCommand Breakdown
-i input.mkv: Specifies the input multi-language MKV file.-map 0:v: Selects all video streams from the first input file (index 0).-map 0:a:m:language:eng: This is the key filter.0:atargets the audio streams of the first input.m:language:engfilters those audio streams to match only those with the metadata language tag set toeng(English).
-map 0:s?: (Optional) Maps all subtitle streams. The trailing?is a wildcard that ensures the command does not fail if the input file contains no subtitles.-c copy: Enables “stream copy” mode. This copies the selected video, audio, and subtitle packets directly without re-encoding them, making the process incredibly fast and preserving 100% of the original quality.output.mkv: The name of the newly created MKV file containing only the English audio.
Dealing with 2-Letter Language Codes
While standard MKV files use 3-letter ISO 639-2 codes (like
eng), some files might use 2-letter ISO 639-1 codes (like
en). If your file uses 2-letter codes, adjust the mapping
syntax accordingly:
ffmpeg -i input.mkv -map 0:v -map 0:a:m:language:en -map 0:s? -c copy output.mkvHow to Verify Track Languages First
Before running the command, you can inspect the file’s streams and
metadata tags using ffprobe to confirm how the languages
are labeled:
ffprobe -v error -show_entries stream=index:stream_tags=language -of default=noprint_wrappers=1 input.mkvThis command will output a list of stream indexes alongside their
respective language tags, allowing you to verify if the English tracks
are marked as eng or en.