Create Multi-Resolution DASH Ladder with FFmpeg

This article provides a complete, step-by-step guide to generating a multi-resolution Dynamic Adaptive Streaming over HTTP (DASH) bitrate ladder using FFmpeg. You will learn how to take a single source video, transcode it into multiple resolutions and bitrates with aligned keyframes, and package the output into a playback-ready DASH manifest (.mpd) and media segments.


Step 1: Understand the Requirements for DASH

To ensure seamless switching between resolutions during playback, your adaptive bitrate (ABR) ladder must meet two strict criteria: 1. Identical Keyframe Intervals (GOP Size): Keyframes must occur at the exact same timestamps across all video streams. If a player switches from 1080p to 720p, it must do so at a keyframe boundary. 2. Segment Alignment: The audio and video segments must be cut at identical intervals (typically between 2 to 6 seconds).

Step 2: The FFmpeg Command

To create a three-tier DASH ladder (1080p, 720p, and 480p) from an input file named input.mp4, run the following command in your terminal:

ffmpeg -i input.mp4 \
  -map 0:v:0 -map 0:v:0 -map 0:v:0 -map 0:a:0 \
  -b:v:0 4500k -s:v:0 1920x1080 -profile:v:0 high \
  -b:v:1 2500k -s:v:1 1280x720 -profile:v:1 main \
  -b:v:2 1000k -s:v:2 854x480 -profile:v:2 main \
  -b:a:0 128k \
  -c:v libx264 -pix_fmt yuv420p \
  -c:a aac \
  -keyint_min 48 -g 48 -sc_threshold 0 \
  -bf 3 -b_strategy 1 \
  -use_timeline 1 -use_template 1 \
  -window_size 5 -adaptation_sets "id=0,streams=v id=1,streams=a" \
  -f dash manifest.mpd

Step 3: Command Breakdown

Here is what each part of the command does:

Stream Mapping

Video Representation Settings

Encoder and Keyframe Settings

DASH Packaging Settings