How to Set Stream Titles in MKV Using FFmpeg

This guide explains how to use FFmpeg to assign custom titles to individual streams—such as video, audio, or subtitle tracks—within an MKV (Matroska) container. You will learn the specific command-line syntax for targeting individual streams, editing their metadata, and saving the changes without re-encoding the media.

The Basic Syntax

To set a title for a specific stream in FFmpeg, you use the -metadata:s option. The s stands for “stream”. The full syntax is:

-metadata:s:[stream_specifier] title="Your Custom Title"

The stream specifier consists of the stream type (such as v for video, a for audio, or s for subtitle) and the zero-based index of that stream.

Step-by-Step Examples

1. Set Title for the First Audio Stream

To name the first audio track “Director’s Commentary”, use the specifier a:0 (audio stream 0):

ffmpeg -i input.mkv -map 0 -c copy -metadata:s:a:0 title="Director's Commentary" output.mkv

2. Set Title for the First Subtitle Stream

To label the first subtitle track as “English SDH”, use the specifier s:0 (subtitle stream 0):

ffmpeg -i input.mkv -map 0 -c copy -metadata:s:s:0 title="English SDH" output.mkv

3. Edit Multiple Stream Titles Simultaneously

You can change the titles of multiple streams in a single command. The following command sets the first audio track to “English 5.1” and the second audio track to “French Stereo”:

ffmpeg -i input.mkv -map 0 -c copy -metadata:s:a:0 title="English 5.1" -metadata:s:a:1 title="French Stereo" output.mkv

Verifying the Changes

After running the command, you can verify that the metadata was successfully applied by running ffprobe:

ffprobe -show_entries stream_tags=title output.mkv

Alternatively, opening the new MKV file in a media player like VLC or MPC-HC will display your custom track titles in the audio or subtitle selection menus.