-disposition:s:v 0 default flag in your FFmpeg command to mark a specific subtitle stream as the default track. This ensures that media players automatically display the chosen subtitles without requiring manual selection by the user.
Understanding Stream Selection and Metadata
When working with video files, especially those created from multiple sources or containing several language tracks, FFmpeg allows you to manipulate which streams are active and how they are flagged. By default, FFmpeg copies all input streams to the output unless you explicitly tell it otherwise. However, simply copying streams does not guarantee that the player will choose the correct one for playback. The "default" flag is a metadata bit set within the container (such as MKV, MP4, or MOV) that tells compliant players which subtitle track should be shown immediately upon starting the video.
To achieve this, you must first identify which stream corresponds to the subtitles you want to prioritize. In FFmpeg syntax, streams are indexed starting from zero. Video streams are typically denoted by v, audio by a, and subtitles by s. If your file has multiple subtitle tracks, they will be numbered sequentially: 0:s:0, 0:s:1, and so on. It is crucial to map these correctly because applying the disposition flag to the wrong index can result in no subtitles being displayed or an error during encoding.
This process is particularly useful when creating archives or distributing videos where you assume a primary language for the audience. Unlike burning subtitles into the video frames, which makes them permanent and unremovable, setting the default flag keeps the subtitles as a separate, selectable layer while ensuring convenience for the end-user.
Identifying Your Subtitle Streams
Before running the conversion command, you need to inspect your source file to determine the exact index of the subtitle track. You can do this by using FFmpeg's built-in information tool. Open your terminal and run the following command, replacing input.mp4 with your actual filename:
ffprobe -v error -select_streams s:0 -show_entries stream=index,codec_name -of default=noprint_wrappers=1:nokey=1 input.mp4
This command isolates subtitle streams and prints their indices and codec names. If you have multiple subtitle tracks, you might see a list like 0 and 1. Note down the index of the track you wish to set as default. For example, if you want the second subtitle track to be the default, its index would likely be 1.
Once you have confirmed the index, you can proceed to construct your encoding command. Remember that if you are remuxing (copying streams without re-encoding) rather than transcoding, the process is faster and preserves quality, but the same logic for setting dispositions applies.
Executing the FFmpeg Command
The core of the solution lies in the -disposition option. This option allows you to modify stream flags. To set a subtitle stream as default, you use the syntax -disposition:s:index default. Here, s stands for subtitle, and index is the number you identified in the previous step.
Below is a comprehensive example command that takes an input video, selects only the video and audio streams along with the specific subtitle track, and sets that subtitle as default:
ffmpeg -i input.mp4 -map 0:v:0 -map 0:a:0 -map 0:s:0 -c copy -disposition:s:0 default output.mp4
In this command:
-i input.mp4specifies the source file.-map 0:v:0selects the first video stream.-map 0:a:0selects the first audio stream.-map 0:s:0selects the first subtitle stream (index 0).-c copyensures streams are copied without re-encoding, saving time and preserving quality.-disposition:s:0 defaultmarks the selected subtitle stream as the default.output.mp4is the resulting file.
If you are dealing with MKV containers, which handle subtitle metadata robustly, this method works identically. For MP4 containers, support for the default flag is widely accepted by modern players like VLC, QuickTime, and HTML5 video elements in browsers.
Handling Multiple Subtitle Tracks
Sometimes you may want to include multiple subtitle tracks but only set one as default. In such cases, you map all desired subtitle streams but apply the disposition flag only to the one you want prioritized. For instance, to include both English and Spanish subtitles but make English the default:
ffmpeg -i input.mkv -map 0:v -map 0:a -map 0:s:0 -map 0:s:1 -c copy -disposition:s:0 default output.mkv
Here, 0:s:0 is marked as default, while 0:s:1 is included but remains non-default. Players will show the English subtitles initially but allow users to switch to Spanish if needed.
Verifying the Result
After encoding, verify that the flag was applied correctly. Use ffprobe again on the output file to check the stream dispositions:
ffprobe -v error -select_streams s:0 -show_entries stream=disposition -of default=noprint_wrappers=1:nokey=1 output.mp4
If the output returns default, the operation was successful. You can also test the file in your preferred media player to confirm that subtitles appear automatically upon playback.
Frequently Asked Questions
Why are my subtitles not showing up even after setting the default flag?
Some older or less compliant media players ignore the default disposition flag entirely. Ensure you are testing with a modern player like VLC or MPV. Additionally, verify that the subtitle codec inside the container is supported by the player; unsupported codecs may fail to render regardless of the default setting.
Can I set multiple subtitle tracks as default simultaneously?
No, the concept of a "default" stream is singular per type. A player can only auto-select one subtitle track at a time. If you need multiple tracks to behave similarly, you must burn them into the video using filters, which removes the ability to toggle them off later.
Does this method work for burned-in subtitles?
No, this method only applies to soft-coded subtitles (separate streams). If subtitles are burned into the video frames using filters like subtitles, they become part of the video stream itself and cannot be toggled or set as default via metadata flags.
How do I remove the default flag from a subtitle track?
You can clear the default flag by using the -disposition:s:index -default syntax. This explicitly removes the default status from the specified stream, leaving it available for manual selection only.
Is there a difference between setting defaults in MKV versus MP4?
While the FFmpeg command syntax remains the same, container support varies slightly. MKV natively supports complex subtitle tagging and is generally more reliable for default flags. MP4 support is good but depends heavily on the specific encoder and player implementation, though most modern standards-compliant players handle it correctly.