tencent cloud

Feedback

CreateTranscode

Last updated: 2023-12-07 10:46:36

    1. API Description

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

    This API is used to create a document transcoding task.

    A maximum of 20 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: CreateTranscode.
    Version Yes String Common Params. The value used for this API: 2019-09-19.
    Region Yes String Common Params. For more information, please see the list of regions supported by the product. This API only supports: ap-singapore.
    SdkAppId Yes Integer SdkAppId of the customer
    Url Yes String URL of the transcoded document after URL encoding. URL encoding converts characters into a format that can be transmitted over the Internet. For example, URL encoding can convert the document URL http://example.com/Test.pdf into http://example.com/%E6%B5%8B%E8%AF%95.pdf. To improve the success rate of URL parsing, use URL encoding.
    IsStaticPPT No Boolean Whether the PowerPoint file is static. The default value is False.
    If IsStaticPPT is False, documents with the .ppt or .pptx extension will be dynamically transcoded to HTML5 pages, and documents with other extensions will be statically transcoded to images. If IsStaticPPT is True, documents with any extensions will be statically transcoded to images.
    MinResolution No String Note: This parameter is disused. Use the MinScaleResolution parameter to pass in a resolution. For more information, see CreateTranscode.

    Minimum resolution of the transcoded document. If no value or null is specified for it or the resolution format is invalid, the original document resolution is used.

    Example: 1280x720. Note that the character between the numbers is the letter x.
    ThumbnailResolution No String Resolution of the thumbnail generated for the dynamically transcoded PowerPoint file. If no value or null is specified for it or the resolution format is invalid, no thumbnail will be generated. The resolution format is the same as that of MinResolution.

    For static transcoding, this parameter does not work.
    CompressFileType No String Compression format of the transcoded file. If no value or null is specified for it or the specified format is invalid, no compression file will be generated. Currently, the following compression formats are supported:

    zip: generates a .zip compression package.
    `tar.gz: generates a .tar.gz compression package.
    ExtraData No String Internal parameter.
    Priority No String Document transcoding priority. This parameter takes effect only for PowerPoint dynamic transcoding. Valid values:

    - low: Low transcoding priority. The task can transcode at most 500 MB of data or a 2000-page document, with a download timeout no longer than 10 minutes. Due to resource limits, these tasks may have to queue for a long period of time. Consider this before you use this feature.
    - null: Normal transcoding priority. The task can transcode at most 200 MB of data or a 500-page document, with a download timeout no longer than 2 minutes.


    Note: For static transcoding such as PDF transcoding, each task can transcode at most 200 MB of data regardless of the transcoding priority.
    MinScaleResolution No String Minimum resolution of the transcoded document. If no value or null is specified for it or the resolution format is invalid, the original document resolution is used.
    Higher resolution brings clearer visual effect, but also means larger size of the transcoded image resources and longer loading time of the transcoded file. Set this parameter appropriately based on your actual scenario.

    Example: 1280x720. Note that the character between the numbers is the letter x.
    AutoHandleUnsupportedElement No Boolean Specifies whether to enable auto handling of unsupported elements. By default, this feature is disabled.

    If auto handling is enabled, the following processes are performed:
    1. Inkblots: Remove unsupported inkblots, such as those drawn by using WPS.
    2. Auto page flip: Clear the auto page clip settings in the PowerPoint file and set the page flip mode to mouse click.
    3. Corrupted audio/videos: Remove the references to corrupted audio/videos in the PowerPoint file.

    3. Output Parameters

    Parameter Name Type Description
    TaskId String Unique ID of the document transcoding task, which is used to query the task progress and transcoding result
    RequestId String The unique request ID, which is returned for each request. RequestId is required for locating a problem.

    4. Example

    Example1 Creating a PowerPoint dynamic transcoding task

    This example shows you how to create a dynamic transcoding task for a PowerPoint file and generate a 960×540 thumbnail.

    Input Example

    POST / HTTP/1.1
    Host: tiw.tencentcloudapi.com
    Content-Type: application/json
    X-TC-Action: CreateTranscode
    <Common request parameters>
    
    {
        "Url": "https://path/to/document.ppt",
        "ThumbnailResolution": "960x540",
        "SdkAppId": "1400000001"
    }
    

    Output Example

    {
        "Response": {
            "RequestId": "eac6b301-a322-493a-8e36-83b295459397",
            "TaskId": "g6ls63ps49vteb8bk1mb"
        }
    }
    

    Example2 Creating a PowerPoint static transcoding task

    This example shows you how to create a static transcoding task for a PowerPoint file.

    Input Example

    POST / HTTP/1.1
    Host: tiw.tencentcloudapi.com
    Content-Type: application/json
    X-TC-Action: CreateTranscode
    <Common request parameters>
    
    {
        "Url": "https://path/to/document.ppt",
        "IsStaticPPT": "True",
        "SdkAppId": "1400000001"
    }
    

    Output Example

    {
        "Response": {
            "RequestId": "eac6b301-a322-493a-8e36-83b295459397",
            "TaskId": "g6ls63ps49vteb8bk1mb"
        }
    }
    

    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
    AuthFailure
    FailedOperation.Transcode Failed to transcode. For more information, see the error description or contact our customer service.
    InvalidParameter.BodyParameterTypeUnmatched The parameter type does not match.
    InvalidParameter.FileFormatUnsupported The document extension is not supported.
    InvalidParameter.SdkAppIdNotFound The SdkAppId does not exist or is invalid.
    InvalidParameter.TranscodeParameter The document transcoding parameter format is invalid.
    LimitExceeded.TaskConcurrency The number of concurrent transcoding or recording tasks exceeds the limit. For more information, see the error description or try again later.
    ResourceUnavailable.NotRegistered TIW is not enabled.
    ResourceUnavailable.ServiceExpired The account is in arrears or the TIW service has expired.
    UnauthorizedOperation.SdkAppId The SdkAppId does not exist or does not match the current Tencent Cloud account.