What Does the ffmpeg -map 1:a:0 Notation Mean?

In multimedia processing, managing multiple audio, video, and subtitle streams can be challenging. This article provides a clear, concise breakdown of the -map 1:a:0 notation in FFmpeg, explaining how it selects specific audio streams from your input files and how you can apply this syntax to control your media transcoding workflows.

Breaking Down the Notation

The -map option in FFmpeg tells the tool which streams from the input files should be included in the output file. The value 1:a:0 is a precise colon-separated identifier that targets a single stream based on three parameters: Input File Index, Stream Type, and Stream Index.

Here is the exact breakdown of 1:a:0:

Therefore, -map 1:a:0 translates to: “Select the first audio stream from the second input file.”

Practical Example

To see this notation in action, consider the following command:

ffmpeg -i video.mp4 -i audio.m4a -map 0:v:0 -map 1:a:0 output.mp4

In this scenario: 1. video.mp4 is input 0. 2. audio.m4a is input 1. 3. -map 0:v:0 selects the first video stream from the first input (video.mp4). 4. -map 1:a:0 selects the first audio stream from the second input (audio.m4a).

The resulting output.mp4 file will combine the video from the first file and the audio from the second file, ignoring any other streams that might have existed in either input.