Live packaging packages live streams in real time, reformatting them in response to playback requests from downstream devices. With live packaging, you can:
Deliver live content in HLS, HLS CMAF, or DASH formats
Enable time-shifted viewing for viewers to replay live content
Store live content to Object Storage Service (OSS) for later playback
How it works
MediaPackage uses a three-level resource hierarchy to receive, package, and deliver live streams:
Channel group
The top-level container that consists of channels and endpoints. When you create a channel group, an origin domain is automatically assigned, which serves as the base URL for all playback requests within the group.
Channel
An entry point that receives live streams from an upstream encoder, each providing two input URLs for redundant ingest. If one input URL encounters issues, the system automatically switches to the other, ensuring continuous delivery.
Endpoint
A part of a channel that defines what streaming format, packaging parameters, and features the output stream will use. You can create multiple endpoints per channel. Each endpoint generates a unique playback URL that players use to request content.
The following outlines the general flow of live content in MediaPackage:
An upstream encoder pushes live streams to a channel's input URLs.
A downstream device, such as a player or a CDN, requests content from a specific endpoint's playback URL.
When MediaPackage receives the playback request, it dynamically packages the stream into the format defined by that specific endpoint.
MediaPackage delivers the packaged stream to the requesting device.
Supported inputs and outputs
Supported input types
Input type | Description |
HLS | Traditional HLS that uses MPEG-2 Transport Stream (.ts) segments. |
HLS_CMAF | HLS that uses the Common Media Application Format (CMAF) with fragmented MP4 (fMP4) segments. |
Encrypted HLS streams are not supported.
Supported output types
Output type | Description | Manifest extension |
HLS | Generates a standard HLS playlist with MPEG-2 Transport Stream (.ts) segments. |
|
HLS_CMAF | Generates an HLS playlist that references CMAF fragmented MP4 (fMP4) segments. |
|
DASH | Generates an MPEG-DASH manifest. |
|
Billing
Live packaging charges fees for stream ingest, packaging, and output delivery. For details, see Billing of live packaging.
For Live-to-VOD, storing live content to OSS incurs storage fees. For more information, see Storage fees of OSS.
Create a channel group
Log on to the Intelligent Media Services console.
In the upper-left corner, select a region.
In the left navigation pane, choose MediaPackage > Live Package.
Click Create Channel Group.
Enter a unique name for the channel group and a description for identification.

Click OK.
Channel groups and channels in Live Package are separate from the Channel Assembly feature of MediaWeaver.
Create a channel
A channel receives live streams from an upstream encoder. Each channel provides two input URLs for redundancy. If one input stops sending content, the system automatically switches to the other.
On the Live Package page, click the channel group name.
Click Create Channel.
Configure the following settings:

Parameter
Description
Channel Name
A unique name for the channel.
Protocol
The input stream protocol.
Valid values: HLS, HLS_CMAF.
Segment Duration
The duration of each segment in seconds. Longer segments increase latency. Shorter segments increase request overhead.
Recommended: 6 seconds.
Segments
The number of segments in the output manifest. A larger number of segments extends the player timeline and increases traffic.
Recommended: 3.
Click OK.
Create an endpoint
An endpoint defines the output format and access controls. Each endpoint generates a playback URL.
Click the channel name to open the channel details page.
Click the Endpoints tab, then click Create Endpoint.
Configure the Basic Information:

Parameter
Description
Endpoint Name
A unique name for the endpoint.
Protocol
The output format. Valid values: HLS, HLS_CMAF, or DASH.
Manifest Name
The manifest filename. Default:
manifest.For example, if you set this to
indexand select HLS as protocol, the playback URL ends withindex.m3u8.Authorization Code
If configured, the content requests from a player or a CDN to this endpoint must include this code in the
AuthorizationHTTP header.IP Address Whitelist
The IPv4/IPv6 addresses or CIDR blocks that are allowed to access this endpoint.
IP Address Blacklist
The IPv4/IPv6 addresses or CIDR blocks that are denied access to this endpoint.
Time-shifted Days
The number of days to retain live content for time-shifted viewing.
Set to 0 to disable time shifting.
This feature is a prerequisite for creating Live-to-VOD assets from the stream.
To learn how to initiate a time-shifted viewing request, see Time-shifted viewing.
Configure the Segment Settings based on the protocol selected:
HLS

Parameter
Description
Segment Duration
The duration of each output segment in seconds. Valid values: 1 to 30.
Audio Separation
When enabled, audio tracks are packaged in separate segments from video.
HLS_CMAF & DASH

Parameter
Description
Segment Duration
The duration of each output segment in seconds. Valid values: 1 to 30.
DRM Encryption
DRM encryption is available for HLS_CMAF and DASH protocols.
Encryption Method
Default: SAMPLE_AES.
Constant Initialization Vector
A 16-byte hex value (32-character string). If empty, MediaPackage auto-generates one.
DRM System ID
Select DRM systems, up to 3 for HLS_CMAF or 2 for DASH.
Supported DRM systems:
HLS_CMAF: Apple FairPlay, Google Widevine, and Microsoft PlayReady.
DASH: Google Widevine and Microsoft PlayReady.
DRM Provider URL
The URL of the proxy for key server communication (up to 512 characters).
Content ID
The unique identifier for the endpoint. If empty, MediaPackage auto-generates one.
Configure the manifest settings:
HLS & HLS_CMAF

Parameter
Description
Segments
The number of segments in the output M3U8 playlist. Valid values: 2 to 100.
Program Date/Time Interval
Interval in seconds to insert
EXT-X-PROGRAM-DATE-TIMEtags. By default, no tags are inserted.Stream Order
The order of streams in the manifest. Valid values:
Original: Sorts the output streams in the same order that the source uses.
Ascending by Bitrate: Sorts the output streams starting with the lowest bitrate.
Descending by Bitrate: Sorts the output streams starting with the highest bitrate.
Min Video Bitrate
Excludes streams with a bitrate lower than this value in the output manifest.
Max Video Bitrate
Excludes streams with a bitrate higher than this value in the output manifest.
DASH

Parameter
Description
Min Buffer Time
The minimum amount of time (in seconds) that a player must keep in the buffer. Default: 2x segment duration. Valid values: 1 to 30.
Min Update Period
The minimum amount of time (in seconds) that the player must wait before requesting manifest updates. Default: 2x segment duration. Valid values: 1 to 3600.
Suggested Presentation Delay
The delay, in seconds, between the point where content is live (the end of the manifest) and where playback begins. For example, with a 35-second presentation delay, requests at 5:30 receive content from 5:29:25.
Manifest Window
A window of content (in seconds) available for replay during live streaming. Valid values: 1 to 3600.
Stream Order
The order of streams in the manifest. Valid values:
Original: Sorts the output streams in the same order that the source uses.
Ascending by Bitrate: Sorts the output streams starting with the lowest bitrate.
Descending by Bitrate: Sorts the output streams starting with the highest bitrate.
Min Video Bitrate
Excludes streams with a bitrate lower than this value in the output manifest.
Max Video Bitrate
Excludes streams with a bitrate higher than this value in the output manifest.
Click OK.
After you create an endpoint, the playback URL appears in the URL column on the Endpoints tab.

Stream ingest
After creating a channel, two input URLs are generated for redundancy.
View input URLs
Go to the channel details page.
Click the Input tab.
Input
Description
ingest1
The primary input URL.
ingest2
The backup input URL. The service automatically failovers to this URL if the primary input becomes unavailable.
URL example:
http://xxxxxx-1.packagepush-9eji12.ap-southeast-1.ice.aliyundoc.com/v1/dfjtest/1/test01/manifestClick Authentication in the Actions column to view the username and password for Basic Auth.
Configure your encoder
Set your encoder's output destination to the primary input URL. For a redundant setup, configure a secondary output to the backup input URL.
Enable Basic Auth with the provided credentials. The encoder must add the following HTTP header to all requests:
Authorization: Basic <BASE64_ENCODE(username:password)>Use HTTP PUT to upload M3U8 playlists and TS segments. The URL for each file must share the same base path as the input URL:
PUT https://<input-url>/manifest.m3u8 PUT https://<input-url>/manifest-hd-1001.ts
Requirements:
Upload valid master playlists, media playlists, and TS segments.
Encrypted HLS streams are not supported.
For redundant ingest, both streams must have identical content with aligned timestamps. Misaligned streams can cause playback failures during a failover.
We recommend using MediaLive as the upstream encoder.
Stream playback
Use the playback URL from the endpoint to play the packaged stream.

For debugging:
Add your IP address to the endpoint's IP whitelist, or
Configure the
Authorizationheader with the endpoint's authorization code
For production:
Configure your CDN to include the Authorization header in origin requests. If you use Alibaba Cloud CDN, refer to Configure outgoing request headers.
Time-shifted viewing
When time shifting is enabled, MediaPackage archives the live content for the specified retention period. Players can access past content by adding time parameters to the standard playback URL.
Example:
https://xxxxx-1.packagepush-9eji12.ap-southeast-1.ice.aliyundoc.com/v1/group01/ch01/endpoint01/index.m3u8?start=2024-11-06T00:00:00Z&vodend=2024-11-06T02:00:00ZTime parameters:
Parameter | Description |
| The start time in UTC. Example: |
| The end time in UTC for live mode. Example: Time-shift playback stays in live mode until it reaches the specified end time. |
| The end time in UTC for VOD mode. All segments are returned at once with an |
| Rewind from the current live edge by the specified number of seconds. Example: |
Usage notes:
Specify either
startoroffset, not both.If both
endandvodendare specified,vodendtakes precedence.
Live-to-VOD
MediaPackage supports creating collection tasks to store live content to OSS for later playback.
Prerequisites
Before you begin, you must have:
An OSS bucket in the same region where the channel group is created. If you do not have one, see Activate OSS and Create a bucket for instructions.
Time shifting enabled on the endpoint (Time-shifted Days > 0)
Create a collection task
On the channel details page, click the Collection Task tab.
Click Create Collection Task.
Configure the following settings:

Parameter
Description
Endpoint
Select an endpoint in the channel with time shifting enabled (Time-shifted Days > 0).
Collection Time
The time range of content to collect.
Storage Path
The OSS bucket for collected files.
Click OK.
The task starts automatically. View collected files in the OSS console.
Multiple collection tasks for the same endpoint generate separate files.
FAQ
How do I ingest live streams?
Use an encoder that supports HLS output. Configure it to push to the channel's input URLs using Basic Auth. We recommend MediaLive.
Why does my collection task have no files?
Ensure time shifting is enabled on the endpoint. Set Time-shifted Days to a value greater than 0.
What are the differences between creating a collection task from the Live Package and Live-to-VOD modules in the IMS console?
Both achieve the same result. Live Package manages collection tasks per channel. Live-to-VOD provides a centralized view of all tasks.