Just-in-Time Media Processing
Overview
Video transcoding is one of the most common video processing methods, which can change the codec, resolution, bitrate and other parameters of the original video to adapt to the playback on different terminals and in network environments.
The traditional offline transcoding is an asynchronous processing mode that requires pre-decoding and encoding of the entire audio and video. The processing time is often 30% to 50% of the original video duration, and the user has to wait for a long time.
EdgeOne's video just-in-time processing allows audio and video files stored in Video on Demand (VOD) and Cloud Object Storage (COS) to be distributed and transcoded immediately after upload, without waiting. Regardless of the video duration, playback in seconds can be achieved, providing users with a new media processing experience.
Note:
The video just-in-time processing feature is currently only available to users of the Enterprise Edition Package.
Billing Instructions
This feature is a paid service and will be billed based on the video processing duration. For details, see Billing Instructions.
Features
Advantage | Details |
Ease of use | There is no need to integrate media processing APIs or SDKs to initiate processing tasks or receive offline transcoding task completion callbacks. The just-in-time transcoding processing allows just-in-time playback of transcoded videos by adding parameters to the original video playback address. |
Very short time | The offline transcoding requires asynchronous waiting for the transcoding task to complete. For the just-in-time transcoding, regardless of the original video duration, the just-in-time transcoded video can be played in a very short time, almost without waiting. |
Reduced storage cost | The traditional offline transcoding feature requires the storage of newly processed file contents, but the just-in-time transcoding does not require the storage of processed videos. It supports caching only to the EdgeOne edge nodes, which reduces the storage cost of the origin server by multiples. |
Practical Scenarios
Scenario | Details |
UGC user uploaded video | The just-in-time transcoding processing takes much less time than the offline processing and is completed almost in sync with distribution. In UGC user scenarios, it allows immediate distribution and playback after upload, greatly enhancing the UGC user experience and increasing user stickiness. |
Long online education video | Long online course video files are usually large, and their codec will cause storage costs to grow exponentially. For example, transcoding an original MP4 video in the traditional way requires separate conversion to 720p, 1080p, and 2k resolutions and muxing into HLS format, so a total of four video files need to be stored. However, if the just-in-time transcoding is used, only one original file needs to be stored, significantly saving storage costs. |
TV stations and OTT | Some video content requires continuous modifications. Video creators can only save the video in MP4 format for easy editing. When there is a terminal playback request, the latest version of the video content will be processed through just-in-time transcoding to a resolution and muxing format for easy playback and immediately distributed, greatly improving efficiency. |
Preparations
In EdgeOne, the domain name has been added, and the origin server can support video just-in-time processing. Currently, the range of origin servers that are supported by the video just-in-time processing feature includes Video on Demand (VOD) and Cloud Object Storage (COS). For VOD origin server instructions, refer to VOD origin server instructions.
Note:
If your current domain name has Token Authentication enabled and the authentication method used is not TypeV Authentication, we recommend that you change the authentication method to TypeV when using the just-in-time transcoding processing to avoid failure in authentication after the video is transcoded to HLS.
Use Method
You can directly implement video processing by concatenating just-in-time processing-related parameters in the client request URL. Refer to the following steps to learn how to use it.
1. Log in to the Tencent Cloud EdgeOne console, click Site List in the left menu bar, and click the site to be configured in the site list.
2. On the site details page, click Multimedia Services > Audio and Video Processing to find the Video Just-In-Time Processing card.
3. Click the Switch for Video Just-In-Time Processing to enable this capability.
4. After this capacity is enabled, you just need to concatenate
/.edgeone-video
and other relevant parameters after the client request URL to pass video processing requirements. EdgeOne will automatically complete the video processing based on the video processing parameters in the client request URL. For parameter concatenation instructions, refer to: How to Concatenate Just-In-Time Transcoding URL.How to Concatenate Just-In-Time Transcoding URL
How to Concatenate Just-In-Time Transcoding URL
You can distribute transcoded videos by spelling the just-in-time transcoded file address according to the following rules, or directly use the Generate Transcoding Address Tool to obtain the transcoded file URL. The specific rules are as follows:
https://www.example.com/video.mp4/.edgeone-video/template={templateName}/media.{ext}
It consists of the following four parts:
1. Original video URL: It is the complete URL of the original video, for example:
https://www.example.com/video.mp4
.2. Fixed parameter for video processing: It is the fixed
/.edgeone-video
directory filled in, indicating the use of EdgeOne's video processing feature.3. Just-in-time transcoding template: It is a template specified for just-in-time transcoding, and
{templateName}
is the template name. Refer to Just-In-Time Transcoding Template for supported templates.4. Transcoded file name: This parameter is fixed as
media
concatenated with a suffix {ext}
. Currently, the supported suffixes include m3u8 and mp4, representing converted HLS and MP4 formats respectively. The specific muxing format supported is determined by Just-In-Time Transcoding Template.Just-In-Time Transcoding Template
EdgeOne provides you with 5 just-in-time transcoding templates. You can choose any of the following transcoding templates based on the resolution you need.
Note:
Note the corresponding audio and video output muxing format when using transcoding templates.
Template Name | Transcoding Template Description | Applicable Muxing Format |
SystemPresetAvcAac540p | Video resolution: 540P, video codec: H.264, video frame rate: 25fps, and audio codec: AAC and dual-channel | Supports HLS |
SystemPresetAvcAac720p | Video resolution: 720P, video codec: H.264, video frame rate: 25fps, and audio codec: AAC and dual-channel | Supports HLS |
SystemPresetAvcAac1080p | Video resolution: 1080P, video codec: H.264, video frame rate: 25fps, and audio codec: AAC and dual-channel | Supports HLS |
SystemPresetAvcAacSourceResolution | Video resolution: same as that of the original video, video codec: H.264, video frame rate: 25fps, and audio codec: AAC and dual-channel | Supports HLS |
SystemPresetRemux | Only remuxing required, which means that the video resolution, video codec, audio codec, and number of channels are all the same as those of the original video | Supports HLS and MP4 |
Spelling Example
Assume your video playback URL is:
https://www.example.com/video.mp4
If you want to obtain the just-in-time transcoded HLS output, choose the SystemPresetAvcAacSourceResolution template. The concatenated just-in-time transcoded URL is:
https://www.example.com/video.mp4/.edgeone-video/template=SystemPresetAvcAacSameSource/media.m3u8
If you want to transcode the video to the HLS format output with 1080P resolution, you can choose the SystemPresetAvcAac1080p template. The spelled URL is:
https://www.example.com/video.mp4/.edgeone-video/template=SystemPresetAvcAac1080p/media.m3u8
If you want to transcode the video to the MP4 format output with 1080P resolution, you can choose the SystemPresetAvcAac1080p template, and the file suffix in the URL needs to be changed to mp4. The spelled URL is:
https://www.example.com/video.mp4/.edgeone-video/template=SystemPresetAvcAac1080p/media.mp4
Using the Generate Transcoding Address Tool
To facilitate users to quickly obtain the transcoding address after parameter concatenation, the EdgeOne console provides the Generate Transcoding Address Tool. By filling in the required transcoding parameters, you can obtain the transcoded file URL.
1. Log in to the Tencent Cloud EdgeOne console, click Site List in the left menu bar, and click the site to be configured in the site list.
2. On the site details page, click Multimedia Services > Audio and Video Processing to find the Video Just-In-Time Processing card.
3. Click the Switch for Video Just-In-Time Processing. After this capability is enabled, click the Generate transcoding address tool.
4. Select a domain name in the site, where the origin server is Video on Demand (VOD) or Cloud Object Storage (COS). Fill in the path of the video to be transcoded and check the target transcoding configuration. Click Preview to preview whether the original video and the transcoded video can play normally. Click Copy link to get the transcoded video playback address for accelerated distribution.
Network protocol: Support HTTP and HTTPS. Note that HTTP protocol cannot be used to preview transcoded videos in the console due to browser limitations; preview and play them externally.
Domain name: Select a domain name that is already bound to the Video on Demand (VOD) or Cloud Object Storage (COS) origin server. If you need to create an origin server, refer to the VOD origin server guide.
Video path: Fill in the access path of audio and video files in the Video on Demand (VOD) or Cloud Object Storage (COS) origin server, such as:
video/test.mp4
.Just-in-time transcoding template: Select a pre-made just-in-time transcoding template. The applicable output video muxing formats for each template can be found in the Transcoding Template.
Muxing format: For video playback, it is recommended to choose the HLS format. The MP4 format is recommended only for video download scenarios.
Preview of original videos: If the original video plays normally, it indicates that the original video path is legal. Otherwise, check if the video path is correct.
Preview of transcoded videos: If the previewed transcoded video plays normally, it indicates that the just-in-time transcoding feature has been successfully triggered. If it is an MP4 file, it will be directly downloaded from the console and preview is not supported.
Use Limits
Original Video Limits
Original videos must be stored in Tencent Cloud VOD or COS.
The original video shall have a duration of no longer than 10 hours, a size of no more than 50 GB, a maximum resolution of 2K, a bitrate of no more than 10 Mbps, and a frame rate of no more than 60 fps.
When the SystemPresetRemux is used for remuxing, the input video must have the video codec of H.264 and the audio codec of AAC.
The following formats are supported for original videos, but it is required that the video and audio indexes are contained in muxing.
Video: MOV, MPEG, MP4, AVI, TS, MKV, M3U8, and M4V.
Audio: MP3, M4A, WAV, and AAC.
Transcoded Video Limits
For HLS format output, multipart transcoding only supports MPEG-TS.
For HLS format output, if Token authentication is enabled for the domain name, only playback under TypeV authentication is supported.
For MP4 format output, MOOV is at the tail (some players may not be compatible with this type of MP4 playback) and only the use of the SystemPresetRemux template is supported.