All Products
Search
Document Center

ApsaraVideo VOD:Export videos

Last Updated:Aug 04, 2025

The video export process involves exporting video configurations, producing the video, and uploading the final file. This topic describes the procedure and methods for exporting videos.

Supported editions

Edition

Supported

Professional Edition

Yes

Standard Edition

Supported

Basic Edition

No

Related class features

Class

Feature

AliyunVideoParam

The video output parameters. This class is used to set the parameters for producing and exporting videos.

AliyunIVodCompose

The video production and upload class. This class includes features related to video production and upload, such as initialization, video production, video upload, and upload credential update.

AliyunComposeFactory

A factory class that is used to create production instances.

Video export procedure

Step

Description

Sample code

1

Export the configurations of the video that is being edited.

Export video configurations

2

Produce the video. The pause, resume, and cancel features are supported.

Produce a video

3

Upload the video. The pause, resume, and cancel features are supported.

Upload a video

4

Release resources.

Release resources

Note
  • The video production operation must be called before the upload operation.

  • The production operation can be called multiple times. The upload operation uploads only the video file that is generated from the most recent production.

  • If you are editing a video object, you must save the video effects to a local configuration file before you create an AliyunIVodCompose instance. Otherwise, the produced video will not contain the effects. The operation to save the edited effects is as follows:

    AliyunIEditor.saveEffectToLocal();

Export video configurations

This operation exports the configurations of the video that is being edited. The final video file is not produced or exported in this step.

For more information about the parameters, see AliyunVideoParam.

// Export the video configurations. The configuration file is eventually output to the specified outputPath.
AliyunIEditor.compose(AliyunVideoParam param, String outputPath, AliyunIComposeCallBack callback);

// Cancel the export of video configurations.
AliyunIEditor.cancelCompose();

Video Synthesis

The Alibaba Cloud Short Video SDK provides a set of operations for video production and upload. You can use these operations to produce and upload edited videos on a separate interface. The AliyunIVodCompose core class encapsulates the video production and upload features to help clients produce and upload videos. The production operation can be called multiple times.

For more information about the parameters, see AliyunIVodCompose and AliyunComposeFactory.

Initialize the production and upload instance

// Create an instance.
AliyunComposeFactory.createAliyunVodCompose();

// Initialize the instance.
AliyunIVodCompose.init(Context context);

Compositing

AliyunIVodCompose.compose(String config, String output, AliyunIComposeCallBack callback);

Comprehensive Control (Pay-as-you-go)

// Pause the production.
AliyunIVodCompose.pauseCompose();
// Resume the production.
AliyunIVodCompose.resumeCompose();
// Cancel the production.
AliyunIVodCompose.cancelCompose();

Upload a video

After the video is produced, call the upload operation to upload the video. The upload operation uploads only the video file that is generated from the most recent production.

For more information about the parameters, see AliyunIVodCompose and AliyunComposeFactory.

Upload

  • Obtain the upload URL and upload credential.

    AliyunIVodCompose uploads a video using an upload URL and an upload credential, which you must obtain before you start the upload. For more information, see Obtain the upload URL and credential for an audio or video file.

  • Upload the video file to an OSS bucket.

    /**
     * Uploads the video to ApsaraVideo VOD.
     * @param options The video upload options. This parameter contains the following properties:
     *        videoPath - The path of the local video file.
     *        uploadAddress - The upload URL provided by Alibaba Cloud.
     *        uploadAuth - The upload credential provided by Alibaba Cloud.
     *        aliyunVodUploadCallBack - The callback for the upload process.
     */
    AliyunIVodCompose.uploadVideoWithVod(VideoUploadOptions options);
  • Refresh the upload credential.

    Upload credentials have a validity period. If an upload credential expires, you must call the onUploadTokenExpired method in the expiration callback to obtain a new upload credential and then call AliyunIVodCompose.refreshWithUploadAuth(String uploadAuth) to refresh the credential. For more information, see Refresh the upload credential for a video.

Control the upload (optional)

// Pause the upload.
AliyunIVodCompose.pauseUpload();
// Resume the upload.
AliyunIVodCompose.resumeUpload();
// Cancel the upload.
AliyunIVodCompose.cancelUpload();

Release resources

After the upload is complete, destroy the instance and release the resources.

AliyunIVodCompose.release();