tencent cloud

APIs

ProcessMedia

Unduh
Mode fokus
Ukuran font
Terakhir diperbarui: 2026-09-22 21:55:53

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 VOD, with features including:

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

If event notification is used, 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, assigned by the VOD backend after successful upload. You can get this field in the video upload completion event notification or the VOD console.
Either FileId or MediaStoragePath must be provided.

MediaStoragePath No String

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

SubAppId No Integer

On-demand application ID. For customers who activate on-demand services after December 25, 2023, this field must be filled with the app ID when accessing resources in on-demand applications (whether the default application or a newly created application).

MediaProcessTask No MediaProcessTaskInput

Video processing type task parameters.

AiContentReviewTask No AiContentReviewTaskInput

Audio and video content review type task parameters .
Not recommended for use. Recommended for use: audio and video moderation (ReviewAudioVideo) or image moderation (ReviewImage).

AiAnalysisTask No AiAnalysisTaskInput

Parameters for the audio and video content analysis task.

AiRecognitionTask No AiRecognitionTaskInput

Audio/video content recognition type task parameter.

TasksPriority No Integer

Priority of the task flow. The higher the value, the higher the priority. The value range is from -10 to 10. If this is not specified, the default value is 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 for special purpose.

Url No String

Valid when FileID is empty. Pull the Url to generate a new media asset and a new FileID. Media processing products will be affiliated products of the new media asset.

Note: Storage fees will occur for the new media asset.

OutputAsIndependentMedia No String

The media processing transcoding result is output as a standalone media asset. Enabling this option will output the product as a standalone media asset and generate a brand new FileID. Currently, only TranscodeTask transcoding tasks support output as a standalone media asset.

Enumeration values:

  • ON: enable
  • OFF: disable

Default value: OFF

Note: New media assets incur storage fees. This option does not currently support enabling for video opening/closing credits, traceable watermark, and other features in transcoding tasks.

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 Trigger a content recognition task using a file path

This example shows you how to trigger a content recognition task for a video with the file path /dir/video.mp4, including face recognition, using 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>

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

Output Example

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

Example2 Trigger a content review task

Initiate a content review task for the video with fileId 5285485487985271487 (offensive, unsafe, and 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 Trigger a content recognition task

Initiate a content recognition task for the video with fileId 5285485487985271487 (including face recognition), using content recognition 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>

{
    "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 to transfer three specifications. The transcoding template IDs used are 20, 30, and 40, respectively. Add a watermark to all transcoded videos, and the watermark template ID is 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 Trigger an intelligent content analysis task

Initiate a content analysis task for the video with fileId 5285485487985271487, including intelligent categorization, intelligent tags, and intelligent cover. 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>

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

Output Example

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

Example6 Initiating a Transcoding Task

This example shows you how to initiate a transcoding task for the video with fileId 5285485487985271487, and transfer three specifications. The transcoding template IDs used are 20, 30, and 40, respectively.

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

This example shows you how to initiate a transcoding task for the video with fileId 5285485487985271487 to transfer three specifications. The transcoding template IDs used are 20, 30, and 40, respectively. At the same time, it also takes sampled screenshots of the video using the sampled screenshot 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>

{
    "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 VOD service is not enabled.
FailedOperation.NoNeedToReduceMediaBitrate No need to perform bitrate reduction.
FailedOperation.TaskDuplicate Operation failed: duplicate task.
InternalError Internal error.
InvalidParameter Parameter error.
InvalidParameterValue Parameter value error.
InvalidParameterValue.AiAnalysisTaskDefinition Parameter value error: AI analysis Definition.
InvalidParameterValue.AiContentReviewTaskDefinition Parameter value error: AI content review Definition.
InvalidParameterValue.AiRecognitionTaskDefinition Parameter value error: AI recognition Definition.
InvalidParameterValue.FileId FileId does not exist.
InvalidParameterValue.SessionContextTooLong SessionContext is too long.
InvalidParameterValue.SessionId Duplicate recognition code. Request deduplicated.
InvalidParameterValue.SessionIdTooLong SessionId is too long.
InvalidParameterValue.SubAppId Parameter value error: app ID.
UnauthorizedOperation Unauthorized operation.

Bantuan dan Dukungan

Apakah halaman ini membantu?

masukan