FFmpeg 7: Unable to Add Multiple Subtitle Streams to MKV (No Longer Possible?)
If you've recently updated your FFmpeg installation to the latest stable version (7.0) and encountered an error when trying to add multiple subtitle streams to an MKV file, you're not alone. This issue has left many users wondering if it's still possible to add multiple subtitles to MKV files using FFmpeg.
Background: Subtitles and FFmpeg
Before diving into the specifics of the problem, it's important to understand what subtitles are and how FFmpeg handles them. Subtitles are textual versions of a film or television program's dialogue that can be displayed on screen. FFmpeg is a powerful, open-source multimedia framework that can handle various video and audio formats, including MKV files. It can also manipulate subtitle streams within these files.
The Problem: Multiple Subtitle Streams in FFmpeg 7
When trying to add multiple subtitle streams to an MKV file using FFmpeg 7, users may encounter the following error:
Multiple -map_metadata entries for input stream 0:0 are not allowed.This error occurs because the latest version of FFmpeg has introduced a change that prevents users from adding multiple subtitle streams to an MKV file using a single command. This is a departure from the behavior in previous versions, such as FFmpeg 6.1.1, which allowed users to add multiple subtitle streams without issue.
Workaround: Add Subtitle Streams Individually
To work around this issue, you can add each subtitle stream individually using separate FFmpeg commands. Here's an example of how to do this:
ffmpeg -i input.mkv -c:v copy -c:a copy -map 0 -map -0:s:0 -map 0:s:1 output1.mkvffmpeg -i input.mkv -c:v copy -c:a copy -map 0 -map -0:s:1 -map 0:s:2 output2.mkvIn this example, the first command adds the first and second subtitle streams to a new MKV file (output1.mkv), while the second command adds the first and third subtitle streams to another new MKV file (output2.mkv). You can repeat this process to add as many subtitle streams as needed.
- Adding multiple subtitle streams to an MKV file using a single FFmpeg 7 command is no longer possible due to a change in the latest version.
- To work around this issue, add each subtitle stream individually using separate FFmpeg commands.
- Resources for further reading include: