Live transcoding is a real-time transcoding feature of Intelligent Media Management (IMM) designed to meet the needs of online video streaming. This topic describes the benefits and usage of live transcoding.
Overview
Unlike media transcoding, which requires the entire video to be transcoded before playback can begin, live transcoding processes only the necessary video segments and allows playback to start immediately after the original video file is uploaded. Live transcoding offers the following benefits:
Instant playback during transcoding and no buffering
Optimized transcoding and smooth playback with scrubbing completed in seconds
On-demand transcoding, re-transcoding in case of deletion of transcoded files, and reduced transcoding and storage costs
Custom transcoding with dozens of custom transcoding parameters
Good compatibility with more than 300 audio and video formats
Live transcoding does not support anonymous playback.
Usage process
Upload a video file to Object Storage Service (OSS).
Call the GenerateVideoPlaylist operation to create a playlist and use the signature feature of OSS to sign the playlist.
Use a player to obtain the playlist and to start playback. Video playback automatically triggers live transcoding.
Scenarios
Play videos stored in network drives: Live transcoding allows videos in network drives to be instantly played upon request on clients at resolutions that best suit actual network conditions. This ensures real-time playback and provides good video compatibility across devices. Live transcoding also reduces storage costs because videos in network drives are not transcoded if the videos are not requested.
Preview and play videos on social media platforms: Live transcoding allows users on instant messaging and social media platforms to immediately play received videos. This improves the timeliness of communications. In addition, when users play videos in chat history that remain unwatched for an extended period of time, they can still be played instantly even if TS objects generated for the videos are regularly cleared to reduce storage usage.
Share video content on forums and blogging platforms: Live transcoding provides users on forums and blogging platforms with a smooth, device-compatible video viewing experience. It allows users to immediately play shared videos at the resolution that best suits their network conditions.
Benefits
The following table describes the benefits of live transcoding in detail.
Benefit | Description |
Standardization |
|
Cost-effectiveness |
|
High efficiency |
|
Supported audio and video formats
The live transcoding feature supports virtually all audio and video formats, encompassing over 300 different types. The following table describes some common audio and video formats supported by live transcoding.
Input video formats | Mainstream formats, such as AVI, MOV, FLV, MKV, WebM, MPEG, WMV, RM, VOB, and TS |
Input audio formats | Mainstream formats, such as MP3, WAV, AAC, FLAC, and WMA |
Output container format | ts |
Prerequisites
An AccessKey pair is created and obtained. For more information, see Create an AccessKey pair.
The relevant objects are uploaded to an OSS bucket. For more information, see Get started by using the OSS console.
IMM is activated and an IMM project is created. For more information, see Activate IMM and Create a project.
You can also create a project by calling the CreateProject operation. For more information, see CreateProject.
You can call the ListProjects operation to query existing projects in a specific region. For more information, see ListProjects.
The RAM user is granted the permissions required to use live transcoding. For more information, see Permissions.
The OSS bucket is bound to the IMM project. For more information about how to bind an OSS bucket to an IMM project in the OSS console or by using the IMM API, see Get started and AttachOSSBucket.
If hotlink protection is configured for the bucket that stores source videos or destination videos, a hotlink protection policy that allows requests with an empty Referer field is configured for the bucket. For more information, see Configure a Referer whitelist or blacklist to prevent other websites from linking to your OSS objects.
If your player needs to initiate cross-origin requests to the bucket that stores destination videos, make sure that cross-origin access to the bucket is allowed from your player. For more information, see CORS.
Examples
Use media playlists
Transcoding task
Source video
Video format: AVI
Video URI: oss://your-oss-bucket-name/test.avi
Destination video
Segment duration: 10 seconds
Pre-transcoded video length: 36 seconds
Video stream format: H.264
Video resolution: 1280 × 720
Frame rate: 25 fps
Video bitrate: 2 Mbit/s
Audio stream format: AAC
Audio bitrate: 128 Kbit/s
Path prefix of the destination object: oss://your-oss-bucket-name/output/media
Step 1: Generate a playlist
Step 2: Sign the playlist
Step 3: Play the video
Use master playlists
Transcoding task
Source video
Video format: AVI
Video URI: oss://your-oss-bucket-name/test.avi
Master playlist URI: oss://your-oss-bucket-name/output/master.m3u8
Destination video 1
Segment duration: 10 seconds
Pre-transcoded video length: 36 seconds
Video stream format: H.264
Video resolution: 1920 × 1080
Frame rate: 25 fps
Audio stream format: AAC
Audio bitrate: 128 Kbit/s
Path prefix of the destination object: oss://your-oss-bucket-name/output/1080p/1080p
Destination video 2
Segment duration: 10 seconds
Pre-transcoded video length: 36 seconds
Video stream format: H.264
Video resolution: 1280 × 720
Frame rate: 25 fps
Audio stream format: AAC
Audio bitrate: 96 Kbit/s
Path prefix of the destination object: oss://your-oss-bucket-name/output/720p/720p
Destination video 3
Segment duration: 10 seconds
Pre-transcoded video length: 36 seconds
Video stream format: H.264
Video resolution: 720 × 540
Frame rate: 25 fps
Audio stream format: AAC
Audio bitrate: 64 Kbit/s
Path prefix of the destination object: oss://your-oss-bucket-name/output/540p/540p
Step 1: Generate a playlist
Step 2: Sign the playlist
Step 3: Play the video
FAQ
Do I need a custom player to play videos transcoded by using live transcoding?
No, you do not. Live transcoding supports the HLS protocol. You can use HLS-compatible video players and browsers, such as ApsaraVideo Player for Web and Safari, to play videos transcoded by using live transcoding.
What destination objects does live transcoding produce?
Live transcoding produces M3U8 and TS objects in the specified path. M3U8 objects are immediately produced.
If you specify a pre-transcoding length, TS objects are asynchronously generated for the specified length and asynchronous on-demand transcoding is triggered on parts for which pre-transcoding is not specified. If the video has never been played, no TS objects are generated for the video part that is not covered by pre-transcoding. For example, if you play the video from the 15th minute, transcoding also starts only from the 15th minute. The following content provides sample output objects:
.
├── outobjprefix.m3u8
├── outobjprefix-c280f054328fcde47c1732a8f2915009-0.ts
├── outobjprefix-c280f054328fcde47c1732a8f2915009-1.ts
├── outobjprefix-c280f054328fcde47c1732a8f2915009-2.ts
├── outobjprefix-c280f054328fcde47c1732a8f2915009-3.tsCan I play a video whose TS objects have been deleted?
Yes, you can play the video even if some or all TS objects are deleted. However, make sure that the video and M3U8 object are not deleted. This is because a request for the M3U8 playlist triggers the regeneration of TS objects. This mechanism allows you to delete TS objects generated for videos that remain unwatched for an extended period of time to reduce storage costs without affecting future playback performance.
Does live transcoding support M3U8 playlists that are not created from live transcoding?
No, live transcoding does not support M3U8 playlists that are not created from live transcoding.
Can I use Alibaba Cloud CDN to accelerate live transcoding?
Yes, you can. For more information, see Use Alibaba Cloud CDN together with live transcoding to accelerate video playback.
