This topic describes the video-on-demand (VOD) packaging feature of MediaPackage.
Overview
The VOD packaging feature packages your VOD resources into different streaming formats, including HTTP Live Streaming (HLS), Dynamic Adaptive Streaming over HTTP (DASH), and HLS - Common Media Application Format (CMAF), for playback. You can also use the feature to encrypt videos based on digital rights management (DRM), protecting your content from unauthorized use.
You are charged fees for using the VOD packaging feature. For more information, see Video-on-demand encapsulation billing.
Limits
The input for packaging must be an M3U8 master playlist.
M3U8 playlists are categorized into master playlists and media playlists.
Sample master playlist
#EXTM3U #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=100000,CODECS="mp4a.40.2,avc1.64001e",RESOLUTION=640x302 video/player-ld.m3u8 #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=200000,CODECS="mp4a.40.2,avc1.64001f",RESOLUTION=848x402 video/player-sd.m3u8 #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=300000,CODECS="mp4a.40.2,avc1.640020",RESOLUTION=1280x606 video/player-hd.m3u8
Sample media playlist
#EXTM3U #EXT-X-VERSION:3 #EXT-X-MEDIA-SEQUENCE:1 #EXT-X-TARGETDURATION:17 #EXTINF:15.500, 1723518810_120.ts #EXT-X-DISCONTINUITY #EXTINF:16.666, 1723518884_121.ts #EXTINF:2.533, 1723518886_122.ts #EXT-X-ENDLIST
The VOD packaging feature can be used to process only files that are stored in Object Storage Service (OSS). Therefore, you must store video files in OSS before you can use the feature. For information about how to use OSS, see Get started with OSS.
ImportantYou are charged fees for files that are stored in OSS. For more information about OSS storage fees, see Storage fees.
The OSS bucket that stores files must reside in the same region where you use the VOD packaging feature.
Configure the feature
Create a packaging group. To do so, log on to the Intelligent Media Services (IMS) console. In the left-side navigation pane, choose . On the page that appears, click Create Group.
Parameter
Description
Packaging Group Name
Enter a custom name. The name must be unique.
Create a packaging configuration. To do so, on the Packaging Groups page, click the packaging group that you created. On the group details page, click Create Packaging Configuration.
The following figure shows the page for creating a packaging configuration:
Parameter
Description
Packaging configuration detail (basic settings)
Name
Enter a custom name. The name must be unique within the packaging group and across different packaging groups.
Package Type
The streaming protocol and segment format.
Apple HLS: packages content into Transport Stream (TS) segments for delivery over the HLS protocol.
DASH-ISO: packages content into CMAF segments for delivery over the DASH protocol.
CMAF: packages content into CMAF segments for delivery over the HLS protocol.
Segment Duration
The duration of a single segment in a packaged stream. Unit: seconds.
We recommend that you set the value to 6. Avoid specifying a too large or too small value. A larger value increases the content of a single segment but also increases latency. A smaller value decreases the content of a single segment but indirectly increases the number of requests, leading to higher resource overhead.
Manifest settings (playback-related settings)
Manifest Name
The manifest name. For example, if you select Apple HLS as Package Type and specify "index" as the manifest name, the playback URL is https://example.aliyundoc.com/index.m3u8.
Stream selection (additional settings for packaged streams)
Enable Stream Selection
Stream selection limits what incoming bitrates are available for playback and sorts the streams in the output. Turn on or off the switch based on your business requirements.
Stream Order
Configure the order of manifest files in the master playlist of a packaged stream, which can differ from the source stream. For example, if manifest files with higher bitrates (BANDWIDTH) are listed at the top in the source stream, you can configure this parameter to list manifest files with lower bitrates at the top in the packaged stream.
Valid values:
Original: sorts the manifest files in the same order as the source.
ASCENDING: sorts the manifest files in ascending order of bitrates, from lowest to highest.
DESCENDING: sorts the manifest files in descending order of bitrates, from highest to lowest.
Min Video Bitrate
The master playlist of a packaged stream does not include manifest files with a bitrate lower than the value of this parameter.
Max Video Bitrate
The master playlist of a packaged stream does not include manifest files with a bitrate higher than the value of this parameter.
Encryption Method (DRM encryption-related settings. You may need to learn about DRM encryption technologies before configuring these settings.)
NoteMediaPackage does not directly provide DRM or key management capabilities. To use DRM, you must work with a third-party DRM provider to prepare the encryption solution in advance. The DRM costs are charged by the third-party DRM provider. IMS does not charge any fees for DRM encryption.
Encryption Method
AES 128-bit
Sample AES
System IDs
Apple FairPlay (94ce86fb-07ff-4f43-adb8-93d2fa968ca2)
Google Widevine (edef8ba9-79d6-4ace-a3c8-27dcd51d21ed)
Microsoft PlayReady (9a04f079-9840-4286-ab92-e65be0885f95)
URL
The URL of the proxy. Make sure that MediaPackage can communicate with the key server through this proxy.
Example 1: https://example.aliyundoc.com/encryption/{token}
Example 2: https://example.aliyundoc.com/encryption -H "{key:value}"
Example 3: https://example.aliyundoc.com/encryption?key1=value1&key2=value2
Constant Initialization Vector
Enter a custom value. The value is a 128-bit, 32-character, hexadecimal-encoded string. If you do not specify this parameter, the initialization vector is rotated periodically.
Use the feature
After the packaging configuration is created, associate your VOD resources with the packaging configuration. To do so, click on the name of the packaging configuration that you created. On the configuration details page, click the Associate Assets tab and then click Ingest Assets. Alternatively, you can ingest assets on the Assets page. For more information, see the following Asset management section.
Asset management
In the left-side navigation pane of the IMS console, choose
. Then, click Ingest Assets.The following figure shows the page for ingesting assets:
The following table describes the parameters:
Parameter | Description |
Packaging Group (packaging-related settings) | |
Packaging Group | Select a packaging group. The packaging configurations within the group all take effect. For example, if a packaging group contains multiple packaging configurations, resources are packaged based on each of the configurations. |
Assets Details | |
Asset Name | Enter a custom name. The name cannot be the same as that of an existing asset. |
Relative Path | Select an M3U8 playlist that is stored in OSS. The playlist must be stored in an OSS bucket that resides in the same region where you use the VOD packaging feature. |
Content ID | If you have configured DRM encryption, this parameter is required. |
Usage notes:
On the Assets page, click on the name of an asset. On the asset details page, you can obtain the playback URLs for the packaged content. You can also click Preview to test the playback of the packaged content.
Asset details:
FAQ
When is packaging performed?
Packaging occurs when an egress endpoint is used for playback, not during asset ingestion.
What do I do if the playback of a packaged stream fails?
If the playback of a packaged stream fails, verify whether the status of the egress endpoint is Playable. If not, check whether your packaging configuration is valid. Note that the input for packaging must be an M3U8 master playlist. For more information, see Limits.
What are the differences between ingesting assets on the Assets page and on a packaging configuration details page?
They are basically the same. You can use either method to perform packaging. However, the Assets page displays all assets on one page, whereas a specific packaging configuration details page displays only assets of the relevant packaging group.