Rename MKV Video Track Title with FFmpeg

This guide explains how to rename or set the title of a specific video track inside an MKV (Matroska) container using the FFmpeg command-line tool. By using metadata mapping and stream copying, you can update the track name in seconds without losing quality or re-encoding the video.

To rename a specific video track, you need to target the metadata of that stream using the -metadata:s:v option. Here is the basic command to rename the title of the first video track:

ffmpeg -i input.mkv -map 0 -c copy -metadata:s:v:0 title="Your New Track Title" output.mkv

Command Breakdown

  • -i input.mkv: Specifies the input file you want to modify.
  • -map 0: Tells FFmpeg to copy all streams (video, audio, subtitles, attachments) from the input file to the output file. Without this, FFmpeg might only copy one stream of each type.
  • -c copy: Enables "stream copy" mode. This copies the video, audio, and subtitle data exactly as they are without re-encoding, making the process virtually instantaneous and maintaining original quality.
  • -metadata:s:v:0 title="Your New Track Title": This is the core instruction.
    • s stands for stream.
    • v stands for video.
    • 0 specifies the index of the video stream (0 is the first video track, 1 is the second, and so on).
    • title="..." sets the new name for the track.
  • output.mkv: The name of the new file containing the updated metadata.

Renaming Multiple Video Tracks

If your MKV container has multiple video tracks (for example, a main video and a picture-in-picture commentary video) and you want to rename a specific one, change the index number at the end of the stream identifier:

  • To rename the first video track:

    -metadata:s:v:0 title="Main Feature"
  • To rename the second video track:

    -metadata:s:v:1 title="Behind the Scenes"

Verifying the Changes

After running the command, you can verify that the metadata has been updated successfully by running ffprobe on the output file:

ffprobe output.mkv

Look for the video stream information in the output, where you should see the title tag updated to your new name.