How to Configure FFmpeg DASH Muxer for WebM
This guide provides a straightforward walkthrough on how to configure the FFmpeg DASH muxer to generate WebM segments instead of the default MP4. You will learn the necessary command-line arguments, compatible video and audio codecs, and specific muxer flags required to output a WebM-compliant Dynamic Adaptive Streaming over HTTP (DASH) manifest and segment files.
To configure FFmpeg’s DASH muxer (-f dash) to output
WebM segments, you must use WebM-compatible codecs (VP9 or VP8 for
video, and Opus or Vorbis for audio) and explicitly instruct the muxer
to use the WebM container format for its segments.
The FFmpeg Command
Below is the standard command structure to convert an input video into WebM DASH segments:
ffmpeg -i input.mp4 \
-c:v libvpx-vp9 -keyint_min 150 -g 150 -sc_threshold 0 \
-c:a libopus -b:a 128k \
-f dash \
-dash_segment_type webm \
-seg_duration 5 \
-init_seg_name "init-\$RepresentationID\$.webm" \
-media_seg_name "chunk-\$RepresentationID\$-\$Number%05d\$.webm" \
manifest.mpdParameter Breakdown
-c:v libvpx-vp9: Encodes the video to VP9, the standard video codec for WebM container formats.-keyint_min 150 -g 150 -sc_threshold 0: Ensures strict Group of Pictures (GOP) alignment. For 30fps video, a GOP of 150 guarantees a keyframe exactly every 5 seconds. This is critical for seamless switching between DASH streams.-c:a libopus: Encodes the audio to Opus, the preferred modern audio codec for WebM.-f dash: Enables the DASH muxer.-dash_segment_type webm: This is the key setting that forces FFmpeg to wrap the DASH chunks in WebM containers instead of the default ISO-BMFF (MP4) containers.-seg_duration 5: Sets the target segment duration to 5 seconds (matching the GOP size).-init_seg_name&-media_seg_name: Defines the file naming structure. The.webmextension in these strings ensures that the initialization chunks and the media chunks are written with the correct file extension.
Once the process is complete, FFmpeg will output an XML-based Media
Presentation Description file (manifest.mpd) alongside a
series of .webm initialization and media segment files
ready for streaming.