The Intelligent Highlights feature uses intelligent algorithms to automatically capture and generate highlights in a video, providing users with quick review and sharing.
Presetting Template
Media Processing Service (MPS) offers an Intelligent Highlights preset template ( Template ID: 26). You can initiate Intelligent Highlights tasks based on this template. For detailed steps, please refer to the section below Initiating Intelligent Highlights Task.
Then, navigate to the API Explorer online debugging page, select ProcessMedia interface, and fill in input/output paths, and template ID. Set AiAnalysisTaskDefinition to 26 (Presetting template for intelligent highlights), and use ExtendedParameter for specific functionalities. Details on extended parameters are provided in the section below Extended Parameters.
Note:
API explorer will automatically convert, so you can directly fill in the corresponding json for ExtendedParameter without converting it into a string. However, if you directly call the API, you need to escape the JSON string. ExtendedParameter example:
For the meaning of the parameters, please refer to the following section Extended Parameter description. To ensure the processing effect, it is recommended that you contact us to confirm the specific configuration offline.
2. Initiating via API
The above explained how to use the API explorer to call and debug the interface online. You can also directly initiate a POST request to Tencent Cloud. API request domain: mps.tencentcloudapi.com. While initiating a POST request, the definition is the preset intelligent highlight template ID (26). Below is a reference example for the request:
Note:
When directly calling the API, you need to escape the JSON string when inputting the ExtendedParameter parameter.
Task callback: When using ProcessMedia to initiate an MPS task, you can set callback information through the TaskNotifyConfig parameter. Once the task is processed, the task result will be called back through the configured callback information. You can parse the event notification results through ParseNotification.
For tasks started with the API and a template as described in Integration Method 1 above, use the TaskId from ProcessMedia (for example: 24000022-WorkflowTask-b20a8exxxxxxx1tt110253) to parse AiAnalysisResultSet in WorkflowTask.
For tasks started via ProcessMedia without a template but with a ScheduleId, the returned TaskId will include "ScheduleTask" (e.g. 24000022-ScheduleTask-774f101xxxxxxx1tt110253). In this scenario, use the TaskId to parse ActivityResultSet in ScheduleTask.
For tasks initiated from the console, as described in Integration Method 2 below, go to Tasks -> VOD for the task ID and results. You can also parse theActivityResultSet in ScheduleTask in the DescribeTaskDetail API to obtain the task results.
Console query task: Enter the console VOD Processing Tasks, the newly initiated tasks will be displayed in the Task List.
When the subtask status is "Success", you can go to COS Bucket > Output Bucket to find your output directory, and the files starting with hht in the directory are the Intelligent Highlights output files, including video files and cover images.
Initiating a task from the console requires a preset template (preset intelligent highlights parameters). Due to some special parameters in the highlights that cannot be configured in the template, it may affect the effect of the Intelligent Highlights. Therefore, it is recommended to use the API integration.
1. Creating a Task
1.1. Go to MPS console and then click Creating a Task > Quick Create a VOD Processing Task.
1.2. First, specify the input video file. Currently, the Horizontal-to-Vertical Video Transformation feature supports two types of input sources: Tencent Cloud Object Storage (COS) and URL download link. AWS S3 is not supported.
1.3. Then, add Intelligent Analysis at the "Process Input Files" step.
1.4. In the pop-up Intelligent Analysis Settings window, select the **Intelligent Highlights Preset Template (Template ID:26)**.
1.5. Finally, specify the output video save path, and click Create to initiate the task.
If you want to upload a video file to the COS bucket and achieve automatic Smart Erase according to preset parameters, you can:
3.1. Click Save the Orchestration when creating the task, and configure the Trigger Bucket, Trigger Directory, and other parameters in the pop-up window.
3.2. Then, go to the VOD Orchestration List, find the newly created orchestration, and enable it by clicking the Enable button. As for the subsequent new video files in the Trigger Directory, tasks will be automatically triggered according to the preset process and parameters in the orchestration, and the processed video files will be saved to the output path configured by the orchestration.
Note:
It takes 3-5 minutes to take effect after the orchestration is successfully enabled.
Scenario Two: Processing Live Streams
1. Initiating Requests
Initiating Requests via API Explorer
To initiate a live stream processing task by calling the API, you can refer to the Initiate Processing on Live Streams. You can click API Explorer Debugging in the file to enter the page, and fill in the relevant parameter information to initiate an online call.
The OutputStorage can be filled in by referring to the offline video scene processing above. An ExtendedParameter example is as follows, and the specific parameter meaning can be found in the Extended Parameters.
A POST request is initiated directly to Tencent Cloud, and the definition is the ID of the created video analysis template. Below is a request reference example:
Note: Only available in offline scenarios. Do not merge for the default value 5003, and merge in other scenarios.
Whether to merge the results into one video:
1: Merge (top_clip parameter does not take effect)
0: Do not merge (merge_time parameter does not take effect)
merge_time
No
int
Note: Only available in offline scenarios. The default value 5003 is the actual output and the time shall not be longer than one hour in other scenarios.
Specify the video output length when merging into one video.