Configure FFmpeg DASH Muxer for WebVTT Subtitles

This guide explains how to configure FFmpeg’s DASH muxer to output WebVTT subtitles alongside your video and audio streams. You will learn the exact command-line arguments needed to map your subtitle files, convert them to the WebVTT format, and package them into a Dynamic Adaptive Streaming over HTTP (DASH) presentation with a properly formatted Media Presentation Description (MPD) manifest.

The Basic Command Structure

To output WebVTT subtitles in a DASH stream, you must input your video, audio, and subtitle files, map the streams, and set the subtitle codec to webvtt while targeting the dash format.

Here is the standard command:

ffmpeg -i video.mp4 -i subtitles.srt \
  -map 0:v:0 -map 0:a:0 -map 1:s:0 \
  -c:v copy -c:a copy \
  -c:s webvtt \
  -f dash output.mpd

Parameter Breakdown


Configuring Subtitle Metadata (Language and Roles)

To ensure video players recognize the language of your subtitles and display them correctly, you should configure metadata. You can define the language and the role of the subtitle track using metadata flags.

ffmpeg -i video.mp4 -i subtitles_en.srt \
  -map 0:v:0 -map 0:a:0 -map 1:s:0 \
  -c:v copy -c:a copy -c:s webvtt \
  -metadata:s:s:0 language=eng \
  -metadata:s:s:0 role=subtitle \
  -f dash output.mpd

Handling Multiple Subtitle Languages

If you need to package multiple subtitle languages into your DASH stream, map each subtitle input and assign the appropriate codec and metadata sequentially.

ffmpeg -i video.mp4 -i subtitles_en.srt -i subtitles_es.srt \
  -map 0:v:0 -map 0:a:0 -map 1:s:0 -map 2:s:0 \
  -c:v copy -c:a copy \
  -c:s webvtt \
  -metadata:s:s:0 language=eng \
  -metadata:s:s:1 language=spa \
  -f dash output.mpd

In this command: * -map 1:s:0 targets the English file and is assigned index s:s:0 (first subtitle stream). * -map 2:s:0 targets the Spanish file and is assigned index s:s:1 (second subtitle stream). * -c:s webvtt applies the WebVTT encoder to all mapped subtitle streams.