EditMedia

Last updated: 2020-11-24 18:53:34

1. API Description

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

This API is used to edit a video (by clipping, splicing, etc.) to generate a new VOD video. Editing features include:

  1. Clipping a file in VOD to generate a new video;
  2. Splicing multiple files in VOD to generate a new video;
  3. Clipping multiple files in VOD and then splicing the clips to generate a new video;
  4. Directly generating a new video from a stream in VOD;
  5. Clipping a stream in VOD to generate a new video;
  6. Splicing multiple streams in VOD to generate a new video;
  7. Clipping multiple streams in VOD and then splicing the clips to generate a new video.

You can also specify whether to perform a task flow for the generated new video.

A maximum of 100 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 parameter. The value used for this API: EditMedia.
Version Yes String Common parameter. The value used for this API: 2018-07-17.
Region No String Common parameter. This parameter is not required for this API.
InputType Yes String Input video type. Valid values: File, Stream.
FileInfos.N No Array of EditMediaFileInfo Information of input video file, which is required if InputType is File.
StreamInfos.N No Array of EditMediaStreamInfo Input stream information, which is required if InputType is Stream.
Definition No Integer Editing template ID. Valid values: 10, 20. If this parameter is left empty, template 10 will be used.
  • 10: the input with the highest resolution will be used as the benchmark;
  • 20: the input with the highest bitrate will be used as the benchmark;
  • ProcedureName No String Task flow template name, which should be entered if you want to perform a task flow on the generated new video.
    OutputConfig No EditMediaOutputConfig Configuration of file generated after editing.
    SessionContext No String Identifies the source context which is used to pass through the user request information. The EditMediaComplete callback and task flow status change callback will return the value of this field. It can contain up to 1,000 characters.
    TasksPriority No Integer Task priority. The higher the value, the higher the priority. Value range: -10-10. If this parameter is left empty, 0 will be used.
    SessionId No String ID used for task deduplication. If there was a request with the same ID in the last three days, the current request will return an error. The ID can contain up to 50 characters. If this parameter is left empty or a blank string is entered, no deduplication will be performed.
    ExtInfo No String Reserved field for special purposes.
    SubAppId No Integer Subapplication ID in VOD. If you need to access a resource in a subapplication, enter the subapplication ID in this field; otherwise, leave it empty.

    3. Output Parameters

    Parameter Name Type Description
    TaskId String Video editing task ID, which can be used to query the status of editing task (with task type being EditMedia).
    RequestId String The unique request ID, which is returned for each request. RequestId is required for locating a problem.

    4. Example

    Example1 Clipping a file in VOD to generate a new video

    This example shows you how to clip the 60th to 120th seconds of video 5285485487985271487 to generate a new VOD video.

    Input Example

    https://vod.tencentcloudapi.com/?Action=EditMedia
    &InputType=File
    &FileInfos.0.FileId=5285485487985271487
    &FileInfos.0.StartTimeOffset=60.0
    &FileInfos.0.EndTimeOffset=120.0
    &<Public request parameters>

    Output Example

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

    Example2 Splicing multiple files in VOD to generate a new video

    This example shows you how to splice videos 5285485487985271487, 5285485487985271488, and 5285485487985271489 to generate a new VOD video.

    Input Example

    https://vod.tencentcloudapi.com/?Action=EditMedia
    &InputType=File
    &FileInfos.0.FileId=5285485487985271487
    &FileInfos.1.FileId=5285485487985271488
    &FileInfos.2.FileId=5285485487985271489
    &<Public request parameters>

    Output Example

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

    Example3 Clipping multiple files in VOD and then splicing the clips to generate a new video

    This example shows you how to clip and splice the 60th to 120th seconds of videos 5285485487985271487, 5285485487985271488, and 5285485487985271489 respectively to generate a new VOD video.

    Input Example

    https://vod.tencentcloudapi.com/?Action=EditMedia
    &InputType=File
    &FileInfos.0.FileId=5285485487985271487
    &FileInfos.0.StartTimeOffset=60.0
    &FileInfos.0.EndTimeOffset=120.0
    &FileInfos.1.FileId=5285485487985271488
    &FileInfos.1.StartTimeOffset=60.0
    &FileInfos.1.EndTimeOffset=120.0
    &FileInfos.2.FileId=5285485487985271489
    &FileInfos.2.StartTimeOffset=60.0
    &FileInfos.2.EndTimeOffset=120.0
    &<Public request parameters>

    Output Example

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

    Example4 Directly generating a new video using a stream in VOD

    This example shows you how to generate a new VOD video using LVB recording stream whose ID is 99873.

    Input Example

    https://vod.tencentcloudapi.com/?Action=EditMedia
    &InputType=Stream
    &StreamInfos.0.StreamId=99873
    &<Public request parameters>

    Output Example

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

    Example5 Clipping a stream in VOD to generate a new video

    This example shows you how to clip the segment between 10:00:00 and 11:00:00 on September 20, 2018 of the LVB recording stream whose ID is 99873 to generate a new VOD video.

    Input Example

    https://vod.tencentcloudapi.com/?Action=EditMedia
    &InputType=Stream
    &StreamInfos.0.StreamId=99873
    &StreamInfos.0.StartTime=2018-09-20T10:00:00Z
    &StreamInfos.0.StartTime=2018-09-20T11:00:00Z
    &<Public request parameters>

    Output Example

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

    Example6 Splicing multiple streams in VOD to generate a new video

    This example shows you how to splice three LVB recording streams (ID: 99873, 99874, and 99875) to generate a new VOD video.

    Input Example

    https://vod.tencentcloudapi.com/?Action=EditMedia
    &InputType=Stream
    &StreamInfos.0.StreamId=99873
    &StreamInfos.1.StreamId=99874
    &StreamInfos.2.StreamId=99875
    &<Public request parameters>

    Output Example

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

    Example7 Clipping multiple streams in VOD and then splicing the clips to generate a new video

    This example shows you how to clip the segments between 10:00:00 and 11:00:00 on September 20, 2018 of three LVB recording streams (ID: 99873, 99874, and 99875) and splice them to generate a new VOD video.

    Input Example

    https://vod.tencentcloudapi.com/?Action=EditMedia
    &InputType=Stream
    &StreamInfos.0.StreamId=99873
    &StreamInfos.0.StartTime=2018-09-20T10:00:00Z
    &StreamInfos.0.StartTime=2018-09-20T11:00:00Z
    &StreamInfos.1.StreamId=99874
    &StreamInfos.1.StartTime=2018-09-20T10:00:00Z
    &StreamInfos.1.StartTime=2018-09-20T11:00:00Z
    &StreamInfos.2.StreamId=99875
    &StreamInfos.2.StartTime=2018-09-20T10:00:00Z
    &StreamInfos.2.StartTime=2018-09-20T11:00:00Z
    &<Public request parameters>

    Output Example

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

    Example8 Clipping a file in VOD to generate a new video and run a task flow

    This example shows you how to clip the 60th to 120th seconds of video 5285485487985271487 to generate a new VOD video and run task flow TranscodeAndSnapshot.

    Input Example

    https://vod.tencentcloudapi.com/?Action=EditMedia
    &InputType=File
    &FileInfos.0.FileId=5285485487985271487
    &FileInfos.0.StartTimeOffset=60.0
    &FileInfos.0.EndTimeOffset=120.0
    &ProcedureName=TranscodeAndSnapshot
    &<Public request parameters>

    Output Example

    {
      "Response": {
        "RequestId": "6ca31e3a-6b8e-4b4e-9256-fdc700064ef3",
        "TaskId": "125xxx65-ComposeMedia-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.InvalidVodUser The VOD service is not activated.
    InternalError Internal error.
    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: subapplication ID
    ResourceNotFound The resource does not exist.
    UnauthorizedOperation Unauthorized operation.

    Was this page helpful?

    Was this page helpful?

    • Not at all
    • Not very helpful
    • Somewhat helpful
    • Very helpful
    • Extremely helpful
    Send Feedback
    Help