Embed WebVTT Subtitles in WebM Using FFmpeg

This guide demonstrates how to embed WebVTT (.vtt) subtitle tracks directly into a WebM video container using FFmpeg. You will learn the precise command-line syntax required to merge your video, audio, and subtitle streams into a single, highly compatible WebM file without re-encoding your video and audio tracks.

The Basic Command

To mux a WebVTT file into an existing WebM video, use the following FFmpeg command:

ffmpeg -i input.webm -i subtitles.vtt -map 0 -map 1 -c:v copy -c:a copy -c:s webvtt output.webm

Parameter Breakdown


Embedding Multiple Subtitle Languages

You can embed multiple WebVTT files for different languages into a single WebM container. Use the metadata flags to label each language track so media players can identify them properly:

ffmpeg -i input.webm -i english.vtt -i spanish.vtt \
-map 0 -map 1 -map 2 \
-c:v copy -c:a copy \
-c:s webvtt \
-metadata:s:s:0 language=eng -metadata:s:s:0 title="English" \
-metadata:s:s:1 language=spa -metadata:s:s:1 title="Spanish" \
output.webm

How the Metadata Mapping Works: