How to Create a Dynamic DASH Playlist with FFmpeg

This article provides a step-by-step guide on how to create a dynamic, continuously updating DASH (Dynamic Adaptive Streaming over HTTP) playlist using FFmpeg. You will learn the exact command-line parameters required to generate a live stream, manage segment cleanup, set window sizes, and ensure seamless playback for your audience.

To create a dynamic DASH playlist (often used for live streaming), you must configure FFmpeg to continuously generate media segments (.m4s files) and constantly update the XML manifest file (.mpd). Unlike static DASH, a dynamic playlist only references the most recent segments, preventing the manifest file from growing indefinitely.

The FFmpeg Command for Dynamic DASH

Below is the standard command used to generate a continuously updating dynamic DASH playlist from a live input source (or a looped file simulating a live source):

ffmpeg -re -i input.mp4 \
  -c:v libx264 -preset veryfast -b:v 2000k -g 60 -keyint_min 60 -sc_threshold 0 \
  -c:a aac -b:a 128k \
  -f dash \
  -seg_duration 4 \
  -window_size 5 \
  -extra_window_size 5 \
  -remove_at_exit 0 \
  -use_template 1 \
  -use_timeline 1 \
  -streaming 1 \
  live_manifest.mpd

Key Parameter Explanations

To ensure your DASH playlist updates continuously without errors, several parameters in the command above are critical:

Serving the Files

Once you run the command, FFmpeg will continuously write the live_manifest.mpd and numbered .m4s segment files to your output directory. Point your web server (such as Nginx or Apache) to this directory. Ensure your web server is configured with the following headers to allow seamless browser playback: