LOG IN SIGN UP
Documentation

Adaptive bitrate playback URL guidelines

Fastly's On-the-Fly Packaging (OTFP) service supports any directory structure you might use to store different quality levels of a video. To construct adaptive bitrate (ABR) playback URLs for a video, make directory paths to that video unique. Ensure all the files associated with a particular video (e.g., quality levels, subtitles) exist under a single directory.

For example, say you had a video called Example Video. Assuming you had multiple quality levels and associated files for Example Video, the following directory structure would provide the best start to constructing ABR playback URLs:

Directory path example Description
/foo/bar/example-video/ Base folder unique to this video
/foo/bar/example-video/480p_30fps.mp4 Quality level 480p with 30 frames per sec with audio
/foo/bar/example-video/720p_30fps.mp4 Quality level 720p with audio with 30 frames per sec with audio
/foo/bar/example-video/720p_60fps.mp4 Quality level 720p with audio with 60 frames per sec with audio
/foo/bar/example-video/1080p_30fps.mp4 Quality level 1080p with audio with 30 frames per sec with audio
/foo/bar/example-video/1080p_60fps.mp4 Quality level 1080p with audio with 60 frames per sec with audio
/foo/bar/example-video/4k_30fps.mp4 Quality level 4k with audio with 30 frames per sec with audio

With this directory structure, the ABR playback URL for all videos in the base directory would follow this template:

http://example.com/path/to/dir/<video_id>/<quality_file1_name_wo_ext>,<quality_file2_name_wo_ext>,...,<quality_fileN_name_wo_ext>/master.<f4m|m3u8|mpd>

For example, the ABR playback URLs for Example Video in every format would be:

Format Example URL
HDS http://example.com/foo/bar/example-video/480p_30fps,720p_30fps,720p_60fps,1080p_30fps,1080p_60fps,4k_30fps/master.f4m
HLS http://example.com/foo/bar/example-video/480p_30fps,720p_30fps,720p_60fps,1080p_30fps,1080p_60fps,4k_30fps/master.m3u8
MPEG-DASH http://example.com/foo/bar/example-video/480p_30fps,720p_30fps,720p_60fps,1080p_30fps,1080p_60fps,4k_30fps/master.mpd

You can reduce the duplication in ABR playback URLs separating out the repeated prefix and suffix info as follows:

<filename_prefix><filename_variable><filename_suffix_wo_ext>.mp4

and the template would change to one of the following:

http://example.com/path/to/dir/<video_id>/<filename_prefix><quality_file1_variable_name_wo_ext>,<quality_file2_variable_name_wo_ext>,...,<quality_fileN_variable_name_wo_ext>,<filename_suffix_wo_ext>/master.<f4m|m3u8|mpd>
http://example.com/path/to/dir/<video_id>/<filename_prefix><quality_file1_variable_name_wo_ext>,<quality_file2_variable_name_wo_ext>,...,<quality_fileN_variable_name_wo_ext>/master.<f4m|m3u8|mpd>
http://example.com/path/to/dir/<video_id>/<quality_file1_variable_name>,<quality_file2_variable_name>,...,<quality_fileN_variable_name>,<filename_suffix_wo_ext>/master.<f4m|m3u8|mpd>