A video file can hold several streams: video, more than one audio track, and subtitles. -map lets you choose exactly which of them go into the output.

Default Behavior Without -map

Without -map, FFmpeg picks one “best” stream of each kind:

  • Video: the highest-resolution stream
  • Audio: the stream with the most channels
  • Subtitles: the first subtitle stream, if the output format and its default subtitle encoder can take it

Within one input file, streams marked as default are favored, so a lower-resolution video or an audio track with fewer channels can be picked. To keep more than one audio track, or a particular subtitle, use -map.

Basic Syntax of -map

-map [input file index]:[stream type]:[stream index]
  • Input file index: the first input is 0, the second is 1, and so on
  • Stream type: v (video), a (audio), s (subtitle), d (data)
  • Stream index: the position among streams of that type, counting from 0

Basic Usage

Select the First Video and First Audio Stream

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

Copy All Streams (Including Subtitles)

ffmpeg -i input.mkv -map 0 -c copy output.mkv

-map 0 puts every stream from input 0 into the output.

Inspecting Stream Information

Before you map, list the audio streams with ffprobe. Remove -select_streams a to list every stream:

ffprobe -v quiet -show_streams -select_streams a input.mkv

Audio streams are counted in the order they appear: the first is 0:a:0, the second 0:a:1. The TAG:language line shows each track’s language, when the file stores one.

Working with Multiple Audio Tracks

Extract Only a Specific Audio Track (the Second One)

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

Include All Audio Tracks

ffmpeg -i input.mkv -map 0:v -map 0:a -c copy output_all_audio.mp4

Selecting Subtitle Streams

Output with Subtitles Included

ffmpeg -i input.mkv -map 0:v:0 -map 0:a:0 -map 0:s:0 -c copy output_with_sub.mkv

Extract Subtitles Only

ffmpeg -i input.mkv -map 0:s:0 output.srt

Without -c:s copy, FFmpeg converts text subtitles such as ASS to SRT as it writes the file. With -c:s copy, anything that is not already SubRip (SRT) fails with Unsupported subtitles codec. Image-based subtitles such as PGS cannot become SRT. Copy them into a .sup file with -c:s copy instead.

Negative Mapping (Excluding Specific Streams)

A - in front of the map value (as in -map -0:s) leaves those streams out:

All Streams Except Subtitles

ffmpeg -i input.mkv -map 0 -map -0:s -c copy output_nosubs.mkv

-map 0 selects all streams, then -map -0:s removes the subtitles. A negative map only removes streams chosen by the maps before it, so it must come after -map 0.

Exclude Only a Specific Audio Track

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

Combining Streams from Multiple Input Files

Take the video from one file and the audio from another, and put them in one file:

ffmpeg -i video.mp4 -i audio.mp3 -map 0:v:0 -map 1:a:0 -c copy output.mp4

Combine Two Language Audio Tracks into One File

ffmpeg -i video.mp4 -i audio_ja.aac -i audio_en.aac \
  -map 0:v:0 -map 1:a:0 -map 2:a:0 \
  -c copy output_bilingual.mkv

Setting Stream Metadata

To set a language tag on each audio track:

ffmpeg -i input.mkv -map 0 -c copy \
  -metadata:s:a:0 language=jpn \
  -metadata:s:a:1 language=eng \
  output.mkv

Summary of Common Use Cases

Goal Command
Extract video only -map 0:v:0
Extract audio only -map 0:a:0
Copy all streams -map 0
All streams except subtitles -map 0 -map -0:s
Replace audio from another file -map 0:v -map 1:a

Measured: time and size

This command was timed:

ffmpeg -i input.mkv -map 0 -c copy output.mkv
Metric Measured
Time 0.41 s (292.76x realtime)
Output size 355.1 MB

Source file: an MKV made from a 1920x1080, 30 fps, 120 s, 351.4 MB video (Big Buck Bunny, Blender Foundation, CC BY 3.0, looped), plus two 128 kb/s AAC audio tracks. Machine: Core i9-14900KF, 32 threads, FFmpeg 8.1 (gyan.dev build), 2026-09-05, one case at a time. The raw numbers are in the dataset.

Why it lands at 0.41 s

With -c copy, FFmpeg decodes and encodes nothing. It takes the packets (the compressed pieces of video and audio) out of the Matroska (MKV) container and writes the same packets into a new one. The only work left is disk reads and writes, plus rebuilding the headers and index. That is how two minutes of 1080p video are copied at 292.76x realtime.

For comparison, re-encoding the same source with no filter takes 27.97 s. Other re-encoding cases in the same run took 18.43 s (downscale to 720p), 42.01 s (curves), 59.37 s (boxblur) and 729.16 s (VP9). Jobs that copy the video stay short: this one at 0.41 s, moving the MP4 index (the moov atom) to the front at 0.49 s, and an audio fade that re-encodes only the audio at 1.03 s. Whether a job can stay in copy mode matters far more than any preset or CRF you choose.

The 355.1 MB output is the same size as the input MKV. -c copy passes the source streams through unchanged, so this is the source’s size, not a compression result. Comparing it with the 86.26 MB re-encode would tell you nothing. The extra 3.7 MB or so over the 351.4 MB video is the two audio tracks.

Copy mode has one limit. Copying subtitles from MKV into MP4 can fail, depending on the subtitle format. For MP4, drop the subtitle streams or convert them to a format MP4 supports. Before you deliver the file, check it with ffprobe: the number of audio tracks, their language tags and the channel layout.