All Products
Search
Document Center

ApsaraVideo VOD:Micro-drama media processing

Last Updated:Jun 11, 2025

The micro-drama solution provides the ability to perform media transcoding jobs through APIs. This article explains the basic API calling methods for micro-drama media transcoding jobs.

Note

Before using micro-drama media processing, ensure you have a basic understanding of media processing. For more information, see ApsaraVideo Media Processing.

Submit media transcoding jobs

Overview

Media transcoding converts an audio or video file into one or more audio or video files to meet the requirements of different network bandwidths, terminal devices, and users.

Interface description

Example

You can call the SubmitTranscodeJobs interface to submit transcoding jobs. Demo:

package com.aliyun.sample;

import com.aliyun.tea.*;

public class Sample {

    /**
     * <b>description</b> :
     * <p>Use your AccessKey pair to initialize the client.</p>
     * @return Client
     * 
     * @throws Exception
     */
    public static com.aliyun.vod20170321.Client createClient() throws Exception {
        // If the project code is leaked, the AccessKey pair may be leaked and security issues may occur on all resources within your account. The following sample code is provided only for reference.
        // For security purposes, we recommend that you use temporary access credentials that are provided by Security Token Service (STS). For more information, see https://www.alibabacloud.com/help/en/sdk/developer-reference/v2-manage-access-credentials.
        com.aliyun.teaopenapi.models.Config config = new com.aliyun.teaopenapi.models.Config()
                // Required. Make sure that the ALIBABA_CLOUD_ACCESS_KEY_ID environment variable is configured.
                .setAccessKeyId(System.getenv("ALIBABA_CLOUD_ACCESS_KEY_ID"))
                // Required. Make sure that the ALIBABA_CLOUD_ACCESS_KEY_SECRET environment variable is configured.
                .setAccessKeySecret(System.getenv("ALIBABA_CLOUD_ACCESS_KEY_SECRET"));
        // For more information about endpoints, see https://api.aliyun.com/product/vod.
        config.endpoint = "vod.cn-shanghai.aliyuncs.com";
        return new com.aliyun.vod20170321.Client(config);
    }

    public static void main(String[] args_) throws Exception {
        java.util.List<String> args = java.util.Arrays.asList(args_);
        com.aliyun.vod20170321.Client client = Sample.createClient();
        com.aliyun.vod20170321.models.SubmitTranscodeJobsRequest submitTranscodeJobsRequest = new com.aliyun.vod20170321.models.SubmitTranscodeJobsRequest();
        com.aliyun.teautil.models.RuntimeOptions runtime = new com.aliyun.teautil.models.RuntimeOptions();
        try {
            // Run the code you write to print the response of the API operation if necessary.
            client.submitTranscodeJobsWithOptions(submitTranscodeJobsRequest, runtime);
        } catch (TeaException error) {
            // Handle exceptions with caution in actual business scenarios and do not ignore the exceptions in your project. In this example, exceptions are provided only for reference.
            // Return error messages.
            System.out.println(error.getMessage());
            // The URL for troubleshooting.
            System.out.println(error.getData().get("Recommend"));
            com.aliyun.teautil.Common.assertAsString(error.message);
        } catch (Exception _error) {
            TeaException error = new TeaException(_error.getMessage(), _error);
            // Handle exceptions with caution in actual business scenarios and do not ignore the exceptions in your project. In this example, exceptions are provided only for reference.
            // Return error messages.
            System.out.println(error.getMessage());
            // The URL for troubleshooting.
            System.out.println(error.getData().get("Recommend"));
            com.aliyun.teautil.Common.assertAsString(error.message);
        }        
    }
}

Query details of a transcoding task

Queries details about transcoding jobs based on the transcoding task ID. This operation supports only querying transcoding tasks within the last year. Demo:

package com.aliyun.sample;

import com.aliyun.tea.*;

public class Sample {

    /**
     * <b>description</b> :
     * <p>Use your AccessKey pair to initialize the client.</p>
     * @return Client
     * 
     * @throws Exception
     */
    public static com.aliyun.vod20170321.Client createClient() throws Exception {
        // If the project code is leaked, the AccessKey pair may be leaked and security issues may occur on all resources within your account. The following sample code is provided only for reference.
        // For security purposes, we recommend that you use temporary access credentials that are provided by Security Token Service (STS). For more information, see https://www.alibabacloud.com/help/en/sdk/developer-reference/v2-manage-access-credentials.
        com.aliyun.teaopenapi.models.Config config = new com.aliyun.teaopenapi.models.Config()
        // Required. Make sure that the ALIBABA_CLOUD_ACCESS_KEY_ID environment variable is configured.
        .setAccessKeyId(System.getenv("ALIBABA_CLOUD_ACCESS_KEY_ID"))
        // Required. Make sure that the ALIBABA_CLOUD_ACCESS_KEY_SECRET environment variable is configured.
        .setAccessKeySecret(System.getenv("ALIBABA_CLOUD_ACCESS_KEY_SECRET"));
        // For more information about endpoints, see https://api.aliyun.com/product/vod.
        config.endpoint = "vod.cn-shanghai.aliyuncs.com";
        return new com.aliyun.vod20170321.Client(config);
    }

    public static void main(String[] args_) throws Exception {
        java.util.List<String> args = java.util.Arrays.asList(args_);
        com.aliyun.vod20170321.Client client = Sample.createClient();
        com.aliyun.vod20170321.models.GetTranscodeTaskRequest getTranscodeTaskRequest = new com.aliyun.vod20170321.models.GetTranscodeTaskRequest();
        com.aliyun.teautil.models.RuntimeOptions runtime = new com.aliyun.teautil.models.RuntimeOptions();
        try {
            // Run the code you write to print the response of the API operation if necessary.
            client.getTranscodeTaskWithOptions(getTranscodeTaskRequest, runtime);
        } catch (TeaException error) {
            // Handle exceptions with caution in actual business scenarios and do not ignore the exceptions in your project. In this example, exceptions are provided only for reference.
            // Return error messages.
            System.out.println(error.getMessage());
            // The URL for troubleshooting.
            System.out.println(error.getData().get("Recommend"));
            com.aliyun.teautil.Common.assertAsString(error.message);
        } catch (Exception _error) {
            TeaException error = new TeaException(_error.getMessage(), _error);
            // Handle exceptions with caution in actual business scenarios and do not ignore the exceptions in your project. In this example, exceptions are provided only for reference.
            // Return error messages.
            System.out.println(error.getMessage());
            // The URL for troubleshooting.
            System.out.println(error.getData().get("Recommend"));
            com.aliyun.teautil.Common.assertAsString(error.message);
        }        
    }
}

Query transcoding tasks

Queries transcoding tasks based on the media ID. This operation does not return specific job information. Demo:

package com.aliyun.sample;

import com.aliyun.tea.*;

public class Sample {

    /**
     * <b>description</b> :
     * <p>Use your AccessKey pair to initialize the client.</p>
     * @return Client
     * 
     * @throws Exception
     */
    public static com.aliyun.vod20170321.Client createClient() throws Exception {
        // If the project code is leaked, the AccessKey pair may be leaked and security issues may occur on all resources within your account. The following sample code is provided only for reference.
        // For security purposes, we recommend that you use temporary access credentials that are provided by Security Token Service (STS). For more information, see https://www.alibabacloud.com/help/en/sdk/developer-reference/v2-manage-access-credentials.
        com.aliyun.teaopenapi.models.Config config = new com.aliyun.teaopenapi.models.Config()
        // Required. Make sure that the ALIBABA_CLOUD_ACCESS_KEY_ID environment variable is configured.
        .setAccessKeyId(System.getenv("ALIBABA_CLOUD_ACCESS_KEY_ID"))
        // Required. Make sure that the ALIBABA_CLOUD_ACCESS_KEY_SECRET environment variable is configured.
        .setAccessKeySecret(System.getenv("ALIBABA_CLOUD_ACCESS_KEY_SECRET"));
        // For more information about endpoints, see https://api.aliyun.com/product/vod.
        config.endpoint = "vod.cn-shanghai.aliyuncs.com";
        return new com.aliyun.vod20170321.Client(config);
    }

    public static void main(String[] args_) throws Exception {
        java.util.List<String> args = java.util.Arrays.asList(args_);
        com.aliyun.vod20170321.Client client = Sample.createClient();
        com.aliyun.vod20170321.models.ListTranscodeTaskRequest listTranscodeTaskRequest = new com.aliyun.vod20170321.models.ListTranscodeTaskRequest();
        com.aliyun.teautil.models.RuntimeOptions runtime = new com.aliyun.teautil.models.RuntimeOptions();
        try {
            // Run the code you write to print the response of the API operation if necessary.
            client.listTranscodeTaskWithOptions(listTranscodeTaskRequest, runtime);
        } catch (TeaException error) {
            // Handle exceptions with caution in actual business scenarios and do not ignore the exceptions in your project. In this example, exceptions are provided only for reference.
            // Return error messages.
            System.out.println(error.getMessage());
            // The URL for troubleshooting.
            System.out.println(error.getData().get("Recommend"));
            com.aliyun.teautil.Common.assertAsString(error.message);
        } catch (Exception _error) {
            TeaException error = new TeaException(_error.getMessage(), _error);
            // Handle exceptions with caution in actual business scenarios and do not ignore the exceptions in your project. In this example, exceptions are provided only for reference.
            // Return error messages.
            System.out.println(error.getMessage());
            // The URL for troubleshooting.
            System.out.println(error.getData().get("Recommend"));
            com.aliyun.teautil.Common.assertAsString(error.message);
        }        
    }
}

FAQ

  1. How to upload without transcoding?

    "No Transcoding" is a special transcoding template. This template does not perform actual transcoding but writes the original video information to the playlist. When you call the GetPlayInfo interface to obtain playback information, you can obtain the playback URL of the original video. This is commonly used in scenarios such as short videos or when quick playback is required after upload. You can select this template group when uploading.

    Only videos in the following formats can be played without transcoding: MP4, FLV, M3U8, MP3, and WEBM.

  2. How to set up automatic scaling of videos according to the original aspect ratio?

    When setting the template output, if you only set the width or height, the other dimension will automatically adapt according to the original aspect ratio.

  3. How to extract an audio track during transcoding?

    • Method 1: Create a new transcoding output with MP4 or HLS as the container format, and check the "Disable Video" option.

    • Method 2: Create a new transcoding output with MP3 as the container format.

  4. How is conditional transcoding typically used?

    Conditional transcoding is often used for high-definition settings. For example, if you have set up a 4K definition but the video uploaded by the user does not reach the bitrate (or resolution) set in the transcoding template, you can choose to:

    • Not perform transcoding for this specification.

    • Transcode according to the input video bitrate (or resolution).