Transcoding
You can transcode livestreams into video streams with different resolutions and bitrates to meet a broad range of requirements.
Function Overview
The transcoding function allows you to:
- Transcode source audio and video into one or more formats for playback on a wide range of devices.
- Adapt the output bitrate to different network bandwidths.
- Reduce the costs of distributing livestreams. H.265 codec and low-bitrate HD can reduce the bitrate by about 20% at the same resolution.
- Customize a transcoding template with settings such as ID, resolution, bitrate, and frame rate.
Notes
- You can configure multiple transcoding templates for one domain name. After a transcoding request is received, the transcoding template whose App Name matches that in the request URL will be applied. If you do not need transcoding, delete the transcoding template before stream push.
- The transcoding template takes effect when livestreams are started. If the transcoding configuration is modified, the modification does not take effect for ongoing livestreams. The modification takes effect only for livestreams pushed after the modification.
- Low-bitrate HD is disabled by default. If you enable it, you will be charged based on the low-bitrate HD transcoding pricing. For details, see Live Pricing Details.
- Upsampling transcoding is not supported. Even if you specify a resolution higher than the source in the template, the streaming URL generated for transcoded streams will be functional, but the streams will still be played at the original resolution.
- After a transcoding template is configured, you need to add _transcoding template name to the end of the corresponding stream name to generate a streaming URL for the transcoded stream. Therefore, the original stream name cannot contain the transcoding template name. For example, if the transcoding template name is hd, the original stream name cannot contain _hd. Otherwise, the program cannot correctly determine whether to trigger transcoding during playback, causing a stream pull exception.
Prerequisites
- You have added an ingest domain name.
- You have configured CNAME records at your domain names' DNS provider.
Pricing Notes
The transcoding function is a billing item. You are charged based on a combination of the codec, output resolution, and length of an output video. Standard transcoding and low-bitrate transcoding are billed differently. For details about the transcoded output resolution, see the Output Resolution column in Live Pricing Details.
Creating a Transcoding Template
You can customize a template on the Live console or by calling the Live API. If you want to play transcoded livestreams, obtain a transcoded streaming URL. For details, see Transcoded Streaming URL.
- Log in to the Live console.
- In the navigation pane, choose .
- Click Manage in the Operation column of the desired ingest domain name.
The subservice type of the domain name must be Cloud Live.
- In the navigation pane, choose Templates > Transcoding to view the transcoding template information.
- Click Create Transcoding Template. The Create Transcoding Template page is displayed, as shown in Figure 2.
Configure transcoding parameters based on Table 1.
Table 1 Transcoding template parameters Parameter
Description
Template Name
Name of the transcoding template. Chinese characters are not supported.
App Name
Application name. The default value is live.
You can customize the application name. Only letters, digits, underscores (_), and hyphens (-) are allowed.
Triggered By
Indicates how live transcoding is triggered. When a transcoding request is received, the transcoding template whose application name matches that in the request URL is applied, and transcoding starts.
- Stream pull: Transcoding is triggered based on the template only when a transcoded stream is requested for playback.
- Stream push: Transcoding is triggered based on the template only when a stream is pushed. Compared with stream pull-triggered transcoding, this push-triggered approach may result in longer transcoding durations and higher associated costs.
The default value is Stream pull If no value is specified, transcoding is triggered by stream push.
CAUTION:- The triggering mode must be consistent across all transcoding templates in an application. Changing the Triggered By value for any template will update all templates under the application to that mode.
- If multiple transcoding templates are configured, the transcoding price is aggregated based on the output specifications of each transcoding template.
Transcoding Type
Live transcoding type.
Options:
- Standard transcoding
- Low-bitrate HD
For the same resolution, low-bitrate HD transcoding consumes 20% less bitrate than standard transcoding but costs more.
Low-bitrate HD means achieving the same image quality at a lower output bitrate. If you enable this function, you will be billed based on the rates of low-bitrate HD. For details, see Live Pricing Details.
Video Encoding
H.264 and H.265 are supported.
Presets (Optional)
Screen resolution.
After the resolution level is selected, the Video Bitrate and Resolution (W x H) parameters are automatically set and the recommended values are provided. You can also change the values as needed.
Video Bitrate
Average bitrate of the transcoded video, in kbit/s.
Value range: 40 to 30,000
Bitrate Control
Bitrate control policy.
Options:
- Disabled: The output uses the specified bitrate. No adaptation is performed.
- Not higher than source stream: The output bitrate is the lower of the specified bitrate and the source stream bitrate. It never exceeds the source stream bitrate.
- Adaptive to source stream: The output bitrate is automatically adjusted based on the source stream bitrate.
Resolution (W x H)
Width and height of the video, in pixel.
If both the width and height are set to 0, the output resolution matches the source resolution. If either the width or height is set to 0, the output resolution will be scaled based on the non-zero dimension.
Value range:
- Width: The value must be 0 or an even number from 32 to 3,840.
- Height: The value must be 0 or an even number from 32 to 2,160.
Video Frame Rate
Frame rate of the transcoded video.
Options:
- Retain the original
- Set a new one: If you select this option, you need to enter the frame rate. The value ranges from 0 to 60. If the value is set to 0, the frame rate is adaptive.
Use Source I-Frame
Policy for outputting I-frames during encoding.
- If this function is disabled, I-frames are output based on the configured GOP duration.
- If this function is enabled, the output preserves the source I-frame positions. If the source contains I-frames, the output inserts I-frames at the same positions. If the source contains no I-frames, the output contains no I-frames.
If this function is enabled, the GOP duration setting does not apply. For multi-bitrate transcoding, enable Use Source I-Frame so outputs at different bitrates share the same I-frame positions.
GOP Duration
I-frame interval by time, in seconds.
The value ranges from 0 to 10 and defaults to 2.
If the value is not 0, the I-frame interval is set based on the GOP duration. If the value is 0, the default value is used.
A larger GOP duration increases live-streaming latency. A smaller GOP duration increases the likelihood of frame freezing.
B-Frame Removal
After this function is enabled, the transcoded video does not contain B-frames.
To configure a transcoding template for low-latency livestreaming, enable B-Frame Removal.
- Click OK.
A transcoding template is added on the live transcoding page.
- Obtain a transcoded streaming URL if you need to stream your video via a transcoded streaming URL. For details, see Transcoded Streaming URL.
Transcoding Template Management
You can perform the following operations on your transcoding templates:
- Edit a transcoding template.
Click Edit in the Operation column to modify parameters in the template. The value of AppName cannot be changed.
The transcoding template takes effect when livestreams are started. If the transcoding configuration is modified, the modification does not take effect for ongoing livestreams. The modification takes effect only for livestreams pushed after the modification.
- Delete a transcoding template.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.
