The production center provides cloud-based video editing and production services. It provides an online visualized editing platform and a wide range of APIs. This topic describes the workflow, processes, and API operations of online editing and provides examples.
Overview
Video generation is important throughout the video production process, which includes collection, generation, playback and interaction, and media asset management. After videos are generated, the generated videos are available for distribution and playback. The production center of ApsaraVideo VOD provides the online editing feature. This feature allows you to cut and merge videos, mix audio, add subtitles, overlay images, mask videos, and apply transition effects.
Online editing is a cloud-based feature that integrates frontend UI components with backend services.
Frontend UI components
You can cut and merge videos, mask videos, add text, modify the sequence of clips, and perform other operations on the UI. For more information, see Use online editing.
Backend services
Backend services include media production and online editing project management.
You can use online editing tools to edit the materials that are uploaded to the media asset library of ApsaraVideo VOD and submit the generated timeline for video production.
You can also collect timeline data and submit the timeline for video production.
The generated videos are stored in the media asset library of ApsaraVideo VOD. You can directly distribute and play the videos without the need to download or upload the videos.
The following figure shows the architecture of online editing.
Term | Description |
material | The original materials used for editing. The input resources must be stored in the media asset library of ApsaraVideo VOD. You can upload video, audio, image, and text files to the media asset library. |
online editing project | The data involved in video production. Online editing projects generally include the basic metadata such as the title and creation time, the materials that are used for editing, and the timeline that describes the video editing content. |
timeline | The product after you arrange the materials and special effects to create an innovative video. |
media production | The process in which you submit the prepared timeline to generate a new media resource after you edit video materials. Media production is an asynchronous process. After you create a media production task, the task ends only after the media resource is generated. |
output resource | The final product after online editing. The final product is stored in the media asset library of ApsaraVideo VOD. |
Prerequisites
The input resources that you want to use for editing must be stored in the media asset library in ApsaraVideo VOD. You can upload media resources or record live streams to the media asset library.
The output resources must be stored in the media asset library of ApsaraVideo VOD.
Limits
The online editing feature is not supported in specific regions. Make sure that the feature is supported in the region where ApsaraVideo VOD is activated before you use the feature. For more information, see Regions.
Process
The online editing process consists of the following stages: input, processing, and output.
Input
Add original materials that you want to use for editing to the material library.
Materials are classified into three types: video, audio, and image. The following table describes the supported formats for different types of materials.
Material type
Supported format
Video
Container format: 3GP, AVI, FLV, MP4, M3U8, MPG, ASF, WMV, MKV, MOV, TS, WebM, and MXF
Encoding format: H.264/AVC, H.263, H.263+, MPEG-1, MPEG-2, MPEG-4, MJPEG, VP8, VP9, Quicktime, RealVideo, and Windows Media Video
Audio
Container format: 3GP, AVI, FLV, MP4, M3U8, MPG, ASF, WMV, MKV, MOV, TS, WebM, and MXF
Encoding format: AAC, AC-3, ADPCM, AMR, DSD, MP1, MP2, MP3, PCM, RealAudio, and Windows Media Audio
Image
JPG, JPEG, PNG, GIF, and APNG
NoteMaterials in the material library are added from the media asset library in ApsaraVideo VOD. Files in the media asset library are classified into source files and transcoded files. To improve the quality of output resources, the source files are used for online editing and production.
Processing
The timeline is the key object in online editing and production. A timeline consists of multiple tracks (layers) and each track consists of multiple clips. You can specify the start time, end time, and effect for each clip, and arrange the sequence of the clips.
You can obtain the timeline data by using one of the following methods:
Use the frontend components to edit media resources and save the data to generate a timeline.
Call API operations or use SDKs of the media editing component to directly submit a timeline.
The media production component is the key component of online editing and is used to generate output resources. The media editing component runs in asynchronous mode. After you call the ProduceEditingProjectVideo operation, the media editing component returns the ID of the generated resource and starts an asynchronous production task based on the specified parameters.
You can listen for the ProduceMediaComplete event to obtain the status of the production task. When you receive the callback, a new resource is generated based on the source files.
You can also query the status of a resource based on the resource ID. If a resource is in the Uploaded state, the resource is generated based on the source files.
NoteThe efficiency of manual queries is low. We recommend that you configure the callbacks to obtain the status of resources.
Online editing project management allows you to create, modify, delete, and query online editing projects and configure materials for the projects. This way, you can manage your online editing projects in depth.
Output
Generate the output resources. All output resources are stored in the media asset library in ApsaraVideo VOD. The following types of output resources are supported: video, audio, and GIF image.
Online editing uses source files for production and saves output resources as source files in the media asset library of ApsaraVideo VOD. The following rules apply when output resources are generated:
The resolution of the output resource is determined by the maximum width and height of the source files that are used to generate the output resource. For example, you use three materials to generate the output resource and the resolutions of the source files are 1280 × 720 pixels, 1920 × 1080 pixels, and 720 × 1280 pixels. In this case, the resolution of the output resource is 1920 × 1280 pixels.
The bitrate of the output resource is determined by the maximum bitrate of the source files that are used to generate the output resource.
By default, H.264 videos are generated as output resources. The container format of the videos is MP4. To change the type of output resources, specify the output parameters in the production template on the configuration page or in the API request. You can change the type of output resources to audio or GIF image.
The following table describes the supported formats for different types of output resources.
Resource type
Supported format
Video
Container format: FLV, MP4, TS, M3U8, and MPD
Encoding format: H.264/AVC and H.265/HEVC
Audio
Container format: FLV, MP4, TS, M3U8, GIF, and MPD
Encoding format: MP3, AAC, VORBIS, and FLAC
Image
GIF
After the output resources are generated, you can specify whether to automatically transcode the generated source files and capture snapshots based on your business requirements. This facilitates content distribution.
You can specify the
TemplateGroupId
parameter inProduceConfig
to configure transcoding for output resources that are generated. If you do not configure this parameter, the system transcodes output resources based on the default transcoding template group after output resources are generated. For more information about how to configure a transcoding template group, see Configure normal transcoding template groups.You can initiate transcoding tasks and capture snapshots only after the output resource is generated.
Generate output resources
Generate output resources by using timeline data
You can directly specify the timeline parameters and call the ProduceEditingProjectVideo operation to generate output resources. This method is applicable to most scenarios. The following figure shows the process.
Generate output resources by using the online editing project
You can specify the ID of an online editing project and call the ProduceEditingProjectVideo operation to generate output resources. This method is applicable when you want to manage an online editing project in depth and submit a production task by using the project. The following methods are supported when you use an online editing project to generate output resources.
Method 1
Call the AddEditingProject operation to create an online editing project and specify the timeline parameters in the request.
Call the ProduceEditingProjectVideo operation and specify the ID of the project in the request.
Method 2
Call the AddEditingProject operation to create an online editing project. The timeline parameters are optional.
Call the UpdateEditingProject operation to update the timeline data of the project.
Call the ProduceEditingProjectVideo operation and specify the ID of the project in the request.
Examples
ApsaraVideo VOD provides multiple examples on how to use timeline data to edit and produce resources:
Splitting and merging: merge multiple videos, split a video and retain the start part, end part, or middle part, and merge parts of multiple videos.
Audio processing: mute, mix, and extract audio, adjust the audio volume, and perform dubbing.
Image overlay: overlay an image on one or more videos in a specified period of time.
Text overlay: add text to a video in a specified period of time.