Map All Subtitles and Ignore Audio in FFmpeg
This article explains how to use FFmpeg to map and retain all subtitle tracks from a media file while completely excluding all audio tracks. Whether you want to keep the video stream along with the subtitles or extract the subtitles by themselves, you will find the precise commands and parameter explanations needed to accomplish this task below.
To discard audio while keeping other streams in FFmpeg, you must
utilize the -map option. By default, FFmpeg’s automatic
stream selection only grabs one stream of each type. Explicitly defining
your maps overrides this behavior, allowing you to select all subtitle
tracks while leaving audio unmapped.
Method 1: Keep Video and All Subtitles (Exclude Audio)
If you want to keep the video track and all available subtitle tracks, but completely remove all audio tracks, use the following command:
ffmpeg -i input.mkv -map 0:v -map 0:s -c copy output.mkvCommand Breakdown: * -i input.mkv:
Specifies the input file. * -map 0:v: Maps all video
streams from the first input file (file index 0). *
-map 0:s: Maps all subtitle streams from the first input
file. * -c copy: Copies the streams directly without
re-encoding them, which preserves original quality and processes the
file almost instantly. * Why audio is ignored: Because
no audio map (such as -map 0:a) is declared, FFmpeg
excludes all audio tracks from the output file.
Method 2: Extract Only All Subtitles (Exclude Video and Audio)
If you want to discard both the video and audio tracks, leaving you with a file containing only the subtitle tracks, use this command:
ffmpeg -i input.mkv -map 0:s -c copy output.mksCommand Breakdown: * -map 0:s:
Instructs FFmpeg to select only subtitle streams. *
output.mks: Uses the Matroska Subtitle (.mks)
container, which is the standard container for holding multiple subtitle
tracks without video or audio.
Method 3: Map Everything Except Audio (Negative Mapping)
If your input file has other stream types you want to keep (such as attachments or fonts) alongside the video and subtitles, you can map the entire file and then explicitly exclude the audio:
ffmpeg -i input.mkv -map 0 -map -0:a -c copy output.mkvCommand Breakdown: * -map 0: Maps every
single stream (video, audio, subtitles, attachments) from the input
file. * -map -0:a: The negative prefix (-)
tells FFmpeg to deselect all audio streams from the current mapping
selection.