Adaptive Bitrate Streaming

Last update:2024-01-09 15:20:41

Adaptive Birate(ABR) addresses the challenges posed by the wide range of user devices and fluctuating network quality. This technology enables users to automatically access video content at the most appropriate bitrate, thereby ensuring an optimal viewing experience. At CDNetworks, we offer comprehensive support for ABR on both HLS and DASH packaging.

How to Use

Structure your fops in the request body as follows:

<op>/<Format>
    /envBandWidth/<value>
    /multiAb/<value>
    /multiVb/<value>
    /multiResolution/<value>
    |saveas/<Urlsafe_Base64_Encode(bucket:filekey)>

Video Transcoding Fops Parameters

Parameter Required Description
op Yes Operation type. For Adaptive Bitrate Strelaming, set the operation type to avthumb.
format Yes Target format for output, supports mp4, flv, m3u8, mpd, etc.
envBandWidth No The bandwidth thresholds for HLS streaming, which refers to the specific bandwidth capabilities at which the player may decide to switch to a different bitrate stream. You may set up to five bandwidth thresholds, but a minimum of two is required. The permitted value range is from 50,000 to 30,000,000 b/s. An example of this setup could be 60000:150000:500000.
Please note:
1. This parameter has to be completed and used when the video output is in HLS format. The number of parameters should align with the counts of MultiVb, multiAb, and multiResolution.
2. It’s recommended to set the bandwidth threshold close to the determined transcoding bitrate value, and ensure it’s arranged in ascending order.
multiAb No The bitrates of audios within adaptive bitrate, measured in bits per second. You can configure up to five audio bitrates, with a minimum requirement of two. An example configuration might be 64k:128k:256k.
Please note:
1. This setup must align with the counts of MultiVb and multiResolution.
2. This setup is incompatible with the audio transcoding parameter ab.
multiVb No The bitrates of videos within adaptive bitrate, measured in bits per second. You can configure up to five video bitrates, with a minimum requirement of two. An example configuration might be 128k:600k:1.25m.
Please note:
1. This setup must align with the counts of MultiAb and multiResolution.
2. This setup is incompatible with the video transcoding parameter vb.
multiResolution No The resolutions of videos within adaptive bitrate, formatted as wxh. You can configure up to five resolutions, with a minimum requirement of two. The setup for these resolutions can be approached in two ways:
1. Width and Height: Explicitly define both w and h for output resolutions(e.g., 320x240:640x480:1080x720). This could possibly stretch the video if output aspect ratios differ from the original.
2. Width or Height: Set only w (aaax-1) or h (-1xaaa), and the output video will adjust its size accordingly. For instance, your settings may look like this: 320x-1:-1x480:1080x-1.
saveas No This parameter defines the output location and filename as a URL-safe Base64-encoded string with the pseudocode Urlsafe_Base64_Encode(bucket:savedfilename).

Request Example

Example Request 1: HLS Adaptive Bitrate

The following example demonstrates how to package an HLS video named test.m3u8 into adaptive bitrate HLS video, named test_file.m3u8 in the bucket vod-wcs-test001. The resulting video will encompass two layers. In the first layer, there will be two .m3u8 files, each delivering videos at varying bitrates and resolutions:

  • First m3u8 - bandwidth threshold: 60kb/s, video bitrate: 128kbit/s, audio Bitrate: 64kbit/s, resolution: 320x240.
  • Second m3u8 - bandwidth threshold: 60kb/s, video bitrate: 600kbit/s, audio bitrate: 128kbit/s, resolution: 640x480.

Pseudocode format for the request:

curl -v -X POST 
–d "bucket=Urlsafe_Base64_Encode(vod-wcs-test001)&key=Urlsafe_Base64_Encode(test_hls.m3u8)&fops=Urlsafe_Base64_Encode(avthumb/m3u8/envBandWidth/60000:100000/multiAb/64k:128k/multiVb/128k:600k/multiResolution/320x240:640x480|saveas/Urlsafe_Base64_Encode(vod-wcs-test001:test_file.m3u8))&force=1&separate=1"
–H "Authorization:AccessKey:EncodeSign" 
--url "http://mgrDomain/fops"

Actual request format:

curl -v -X POST 
-d "bucket=dm9kLXdjcy10ZXN0MDAx&key=dGVzdF9obHMubTN1OA==&fops=YXZ0aHVtYi9tM3U4L2VudkJhbmRXaWR0aC81MDAwMDoxMDAwMDAvbXVsdGlBYi82NGs6MTI4ay9tdWx0aVZiLzEyOGs6NjAway9tdWx0aVJlc29sdXRpb24vMzIweDI0MDo2NDB4NDgwfHNhdmVhcy9kbTlrTFhkamN5MTBaWE4wTURBeE9uUmxjM1JmWm1sc1pTNXRNM1U0&force=1&separate=1"
-H "Authorization:AccessKey:EncodeSign" 
--url "http://mgrDomain/fops"

Example Request 2: DASH Adaptive Bitrate

This example illustrates how to package an MP4 video named test.mp4 into adaptive bitrate DASH video, named test.mpd in the bucket vod-wcs-test001. The resulting DASH video output will encompass two different video streams and a single audio stream:

  • Video A - bitrate: 128kbit/s, resolution: 320x240.
  • Video B - bitrate: 600kbit/s, resolution: 640x480.
  • Audio - bitrate: 64kbit/s.

Pseudocode format for the request:

curl -v -X POST 
–d "bucket=Urlsafe_Base64_Encode(vod-wcs-test001)&key=Urlsafe_Base64_Encode(test_hls.m3u8)&fops=Urlsafe_Base64_Encode(avthumb/mpd/multiVb/128k:600k/multiAb/64k/multiResolution/320x240:640x480|saveas/Urlsafe_Base64_Encode(vod-wcs-test001:test.mpd))&force=1&separate=1"
–H "Authorization:AccessKey:EncodeSign" 
--url "http://mgrDomain/fops"

For actual request format, you can refer to example 1.

Is the content of this document helpful to you?
Yes
I have suggestion
Submitted successfully! Thank you very much for your feedback, we will continue to strive to do better!