tencent cloud

Video on Demand

문서Video on Demand

ProcessMedia

Download
포커스 모드
폰트 크기
마지막 업데이트 시간: 2026-05-19 15:01:44

1. API Description

Domain name for API request: vod.intl.tencentcloudapi.com.

This API is used to initiate processing tasks for audio-video media in on-demand video, with features including:

  1. Video transcoding (watermarked);
  2. Video-to-GIF.
  3. Screenshot taking at specified time points;
  4. Sampled screenshot taking;
  5. Capture CSS sprites from video.
  6. Capture a cover image from the video.
  7. Transcoding to adaptive bitrate streaming (and encrypting);
  8. Content review (offensive content, unsafe information, inappropriate information). Not recommended to use this API for initiation. Recommended for use: Audio-Video Moderation (ReviewAudioVideo) or Image Moderation (ReviewImage).
  9. Content analysis (tag, category, cover, frame tagging), HLS format not supported currently;
  10. Content recognition (video intro and outro, human face, full text, text keyword, full speech, speech keyword, object).

If you use event notification, the event notification type is task flow status change (https://www.tencentcloud.com/document/product/266/9636?from_cn_redirect=1).

A maximum of 200 requests can be initiated per second for this API.

We recommend you to use API Explorer
Try it
API Explorer provides a range of capabilities, including online call, signature authentication, SDK code generation, and API quick search. It enables you to view the request, response, and auto-generated examples.

2. Input Parameters

The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.

Parameter Name Required Type Description
Action Yes String Common Params. The value used for this API: ProcessMedia.
Version Yes String Common Params. The value used for this API: 2018-07-17.
Region No String Common Params. This parameter is not required.
FileId No String

Media file ID, the globally unique identifier of the file in VOD, is assigned by the VOD backend after a successful upload. You can get this field in the video upload completion event notification or the VOD console.
You must provide one of FileId and MediaStoragePath.

MediaStoragePath No String

Storage path of the media.
Only sub-applications in FileID + Path mode can initiate task through MediaStoragePath.
Either FileId or MediaStoragePath must be provided.

SubAppId No Integer

Video-on-demand (VOD) application ID. Customers who activate on-demand services from December 25, 2023 must fill this field with the app ID to access resources in on-demand applications (whether default or newly created application).

MediaProcessTask No MediaProcessTaskInput

Parameters for the video processing type task.

AiContentReviewTask No AiContentReviewTaskInput

Audio and video content review type task parameters.
* Not recommended for use. It is recommended to use ReviewAudioVideo or ReviewImage.

AiAnalysisTask No AiAnalysisTaskInput

Parameters for the audio and video content analysis task.

AiRecognitionTask No AiRecognitionTaskInput

Parameters for the audio/video content recognition task.

TasksPriority No Integer

Priority of the task flow. The higher the value, the higher the priority. The value ranges from -10 to 10. If this is not specified, it represents 0.

TasksNotifyMode No String

Task flow status change notification mode. Valid values are Finish, Change, and None. If this is not specified, the default value is Finish.

SessionContext No String

Source context. This is used to pass user request information. The task status change callback returns the value of this field. The maximum length is 1000 characters.

SessionId No String

Identifier for deduplication. If a request with the same identifier has been sent within the past three days, an error is returned for the current request. The maximum length is 50 characters. If this is not specified or left empty, deduplication is not performed.

ExtInfo No String

Reserved field, used when special purpose.

Url No String

Valid when FileID is empty. Pull the Url to generate new media assets and generate a new FileID. The media processing product will be affiliated with the new media assets.

Note: Storage fees will occur for new media assets.

3. Output Parameters

Parameter Name Type Description
TaskId String

Task ID.

RequestId String The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem.

4. Example

Example1 Using file path to trigger content recognition task

Trigger a content recognition task (including face recognition) for the video with file path /dir/video.mp4. The template ID used for content recognition is 10.

Input Example

POST / HTTP/1.1
Host: vod.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: ProcessMedia
<Common request parameters>

{
    "AiRecognitionTask": {
        "Definition": 10
    },
    "MediaStoragePath": "/dir/video.mp4"
}

Output Example

{
    "Response": {
        "RequestId": "6ca31e3a-6b8e-4b4e-9256-fdc70006fje1",
        "TaskId": "125xxx65-procedurev2-bffb15f07586237bcecodb01fac7kdabc"
    }
}

Example2 Initiate a content review task

Initiate a content review task for the video with fileId 5285485487985271487 (offensive content, unsafe information, inappropriate information), using content review template ID 10.

Input Example

POST / HTTP/1.1
Host: vod.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: ProcessMedia
<Common request parameters>

{
    "AiContentReviewTask": {
        "Definition": 10
    },
    "FileId": "5285485487985271487"
}

Output Example

{
    "Response": {
        "RequestId": "6ca31e3a-6b8e-4b4e-9256-fdc700064ef3",
        "TaskId": "125xxx65-procedurev2-bffb15f07530b57bc1aabb01fac74bca"
    }
}

Example3 Initiating a Content Recognition Task

Trigger a content recognition task (including face recognition) for the video with fileId 5285485487985271487. The template ID used for content recognition is 10.

Input Example

POST / HTTP/1.1
Host: vod.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: ProcessMedia
<Common request parameters>

{
    "AiRecognitionTask": {
        "Definition": 10
    },
    "FileId": "5285485487985271487"
}

Output Example

{
    "Response": {
        "RequestId": "6ca31e3a-6b8e-4b4e-9256-fdc70006fje1",
        "TaskId": "125xxx65-procedurev2-bffb15f07586237bcecodb01fac7kdabc"
    }
}

Example4 Initiating a Watermarked Transcoding Task

Initiate a transcoding task for the video with fileId 5285485487985271487, transfer three specifications, and the transcoding template IDs used are 20, 30, and 40, respectively. All transcoded videos are watermarked with template ID 15780.

Input Example

POST / HTTP/1.1
Host: vod.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: ProcessMedia
<Common request parameters>

{
    "MediaProcessTask": {
        "TranscodeTaskSet": [
            {
                "Definition": 30,
                "WatermarkSet": [
                    {
                        "Definition": 15780
                    }
                ]
            },
            {
                "Definition": 20,
                "WatermarkSet": [
                    {
                        "Definition": 15780
                    }
                ]
            },
            {
                "Definition": 40,
                "WatermarkSet": [
                    {
                        "Definition": 15780
                    }
                ]
            }
        ]
    },
    "FileId": "5285485487985271487"
}

Output Example

{
    "Response": {
        "RequestId": "6ca31e3a-6b8e-4b4e-9256-fdc700064ef3",
        "TaskId": "125xxx65-procedurev2-bffb15f07530b57bc1aabb01fac74bca"
    }
}

Example5 Initiating an Intelligent Content Analysis Task

Trigger a content analysis task for the video with fileId 5285485487985271487, including intelligent classification, intelligent tag and intelligent cover. The template ID used for content analysis is 10.

Input Example

POST / HTTP/1.1
Host: vod.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: ProcessMedia
<Common request parameters>

{
    "AiAnalysisTask": {
        "Definition": 10
    },
    "FileId": "5285485487985271487"
}

Output Example

{
    "Response": {
        "RequestId": "6ca31e3a-6b8e-4b4e-9256-fdc700064ef3",
        "TaskId": "125xxx65-procedurev2-bffb15f07586237bcecodb01fac7kdikk"
    }
}

Example6 Initiating a Transcoding Task

Initiate a transcoding task for the video with fileId 5285485487985271487, transfer three specifications, and the transcoding template IDs used are 20, 30, and 40.

Input Example

POST / HTTP/1.1
Host: vod.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: ProcessMedia
<Common request parameters>

{
    "MediaProcessTask": {
        "TranscodeTaskSet": [
            {
                "Definition": 30
            },
            {
                "Definition": 20
            },
            {
                "Definition": 40
            }
        ]
    },
    "FileId": "5285485487985271487"
}

Output Example

{
    "Response": {
        "RequestId": "6ca31e3a-6b8e-4b4e-9256-fdc700064ef3",
        "TaskId": "125xxx65-procedurev2-bffb15f07530b57bc1aabb01fac74bca"
    }
}

Example7 Initiating Transcoding and Sampling Screenshot Tasks

Initiate a transcoding task for the video with fileId 5285485487985271487, transfer three specifications, and the transcoding template IDs used are 20, 30, and 40. Meanwhile, perform sampling screenshot taking for the video, and the template ID used is 10.

Input Example

POST / HTTP/1.1
Host: vod.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: ProcessMedia
<Common request parameters>

{
    "MediaProcessTask": {
        "TranscodeTaskSet": [
            {
                "Definition": 30
            },
            {
                "Definition": 20
            },
            {
                "Definition": 40
            }
        ],
        "SampleSnapshotTaskSet": [
            {
                "Definition": 10
            }
        ]
    },
    "FileId": "5285485487985271487"
}

Output Example

{
    "Response": {
        "RequestId": "6ca31e3a-6b8e-4b4e-9256-fdc700064ef3",
        "TaskId": "125xxx65-procedurev2-bffb15f07530b57bc1aabb01fac74bca"
    }
}

5. Developer Resources

SDK

TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.

Command Line Interface

6. Error Code

The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.

Error Code Description
FailedOperation Operation failed.
FailedOperation.InvalidVodUser The VOD service is not activated.
FailedOperation.NoNeedToReduceMediaBitrate No need to reduce the bitrate.
FailedOperation.TaskDuplicate Operation failed: the task already exists.
InternalError Internal error.
InvalidParameter Parameter error.
InvalidParameterValue Parameter value error.
InvalidParameterValue.AiAnalysisTaskDefinition Incorrect parameter value: Definition for AI-based analysis.
InvalidParameterValue.AiContentReviewTaskDefinition Incorrect parameter value: Definition AI-based content audit.
InvalidParameterValue.AiRecognitionTaskDefinition Incorrect parameter value: Definition for AI-based recognition.
InvalidParameterValue.FileId The FileId does not exist.
InvalidParameterValue.SessionContextTooLong SessionContext is too long.
InvalidParameterValue.SessionId The deduplication ID already exists. The request is removed due to duplication.
InvalidParameterValue.SessionIdTooLong SessionId is too long.
InvalidParameterValue.SubAppId Incorrect parameter value: application id.
UnauthorizedOperation Unauthorized operation.

도움말 및 지원

문제 해결에 도움이 되었나요?

피드백