Video production plays an important role in the entire video chain from video capture, production, playback and interaction, to media asset management. After being produced, the captured videos are available for distribution and playback. As the production center of ApsaraVideo for VOD, the video editing (online editing) service supports features such as cutting and merging, audio mixing, text overlay, image overlay, masking, and transition effects. It provides an online visual editing platform and related API operations.
- Input: the media resources to be edited. The input resources must be stored in the media library in ApsaraVideo for VOD. You can upload media resources to the media library or record live streams into the media library.
- Output: the media resources generated after editing and production. The output resources are also stored in the media library in ApsaraVideo for VOD.
Online editing is a cloud-based product that integrates frontend components or pages and backend services. For more information about the frontend components or pages, see User Guide > Production Center. The backend services include the media editing service and the online editing project management service.
You can use online editing tools to edit the materials uploaded to the media library in ApsaraVideo for VOD and submit the generated timeline for video production. You can also organize timeline data and submit the timeline for video production. The new videos produced are stored in the media library in ApsaraVideo for VOD. You can directly distribute and play them with no need of download or upload.
The following figure shows the overall architecture of online editing.
|Material||The raw materials provided for editing.|
|Timeline||The product of material orchestration and special effect design based on creative ideas.|
|Online editing project||The data involved in one video editing process. It generally includes the basic metadata (such as the title and creation time), the materials required for video editing, and the timeline that describes the video editing content.|
|Production task||The task for submitting the prepared timeline and starting video production to generate new media resources after video materials are edited. Media resource production is an asynchronous process. A production task describes the process from task creation to final completion of media resource production.|
|Finished resource||The final product of online editing. It is also stored in the media library in ApsaraVideo for VOD.|
The core chain of online editing is divided into the following parts: input, processing, and output.
The input of online editing is the material library, which stores the raw materials for editing.
Materials in the material library are classified into videos, audio, and images. The following table lists the formats supported for various materials.
|Video||Container formats: 3GP, AVI, FLV, MP4, M3U8, MPG, ASF, WMV, MKV, MOV, TS, WebM, MXF, and so on
Codec formats: H. 264 or AVC, H. 263, H. 263+, MPEG-1, MPEG-2, MPEG-4, MJPEG, VP8, VP9, Quicktime, RealVideo, Windows Media Video, and so on
|Audio||Container formats: 3GP, AVI, FLV, MP4, M3U8, MPG, ASF, WMV, MKV, MOV, TS, WebM, MXF, and so on
Codec formats: AAC, AC-3, ADPCM, AMR, DSD, MP1, MP2, MP3, PCM, RealAudio, and Windows Media Audio
|Image||JPG, JPEG, PNG, GIF, and APNG
Currently, materials in the material library come from the media library in ApsaraVideo for VOD. Files in the media library are classified into mezzanine files and transcoded files. To ensure the best quality of finished resources, the online editing service uses the mezzanine files of ApsaraVideo for VOD resources for editing and production.
The core object in editing and production is the timeline. A timeline consists of multiple tracks (also called layers). 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 generate a timeline or directly submit a timeline as follows:
- Use the frontend components to edit media resources and save the editing data to generate a timeline.
- Call the API or SDK of the media editing service to directly submit a timeline.
As the core service of online editing, the media editing service generates the finished resources. The media editing service is running in asynchronous mode. After you call the media production operation ProduceEditingProjectVideo, the service returns the ID of the new resource synchronously and starts an asynchronous production task based on the specified parameters. For more information, see ProduceEditingProjectVideo. When the production is completed, you can receive the callback event ProduceMediaComplete, indicating that the new resource has been produced based on the mezzanine files. The following figure shows the process.
You can also query the status of the new resource based on the resource ID. When the new resource is in the uploaded status, the new resource has been produced based on the mezzanine files. The efficiency of manual queries is low. We recommend that you configure the callback mechanism to receive production completion notifications.
The online editing project management service allows you to create, modify, delete, and query online editing projects and configure materials for the projects. You can use this service to manage your online editing projects in depth.
The output of online editing is the finished resources. Currently, all finished resources of online editing are stored in the media library. The following output resource types are supported: video, audio, and image (GIF).
For video production in the online editing service, the core design rule is that both the input and output files are mezzanine files, as shown in the following figure.The online editing service produces a new resource based on the mezzanine files of materials in the material library. Then, it stores the produced files as the mezzanine files of resources in the media library in ApsaraVideo for VOD.
A finished resource (media file) generated after online editing also complies with the following rules:
- The resolution of the finished resource is determined by the maximum width and height in the mezzanine file resolutions of the materials used by the timeline.Assume that the timeline uses three materials whose mezzanine file resolutions are 1280 × 720 pixels, 1920 × 1080 pixels, and 720 × 1280 pixels respectively. Then, the resolution of the finished resource is 1920 × 1280 pixels.
- The bitrate of the finished resource is determined by the maximum bitrate of the mezzanine files of the materials used by the timeline.
- The default type of the finished resource is video, with the codec format being H. 264 and the container format being MP4. You can also select a production template on the configuration page or specify it in the API call request, and set the finished resource type (such as audio or GIF) and detailed template parameters.
The following table lists the formats supported for finished resources.
|Video||Container formats: FLV, MP4, TS, M3U8, and MPD
Codec formats: H. 264 or AVC and H. 265 or HEVC
|Audio||Container formats: FLV, MP4, TS, M3U8, and MPD
Codec formats: MP3, AAC, VORBIS, and FLAC
After the production is completed, the mezzanine files of finished resources are generated. Then, the system automatically transcodes the mezzanine files and takes snapshots based on your requirements to facilitate fast distribution.
- You can set the TemplateGroupId parameter in ProduceConfig to specify the transcoding process to be started after the production is completed. If this parameter is not set, the system starts a transcoding process based on the configured default template group after the production is completed. For more information about how to configure a transcoding template group, see Global settings > Transcoding settings.
- As the post-processing operations of the media editing service, transcoding and snapshot taking are initiated only after the mezzanine files are generated.
You can directly specify the timeline parameters and call the ProduceEditingProjectVideo operation to perform video production, as shown in the following figure. This method is applicable to most scenarios.
You can specify the ID of an online editing project and call the ProduceEditingProjectVideo operation to start media production. This method is applicable when you need to manage an online editing project in depth and submit a production task through the project. This method can be further divided into two modes:
- Mode 1
- Call the AddEditingProject operation to create an online editing project. When calling the operation, specify the timeline parameters for the project.
- Call the ProduceEditingProjectVideo operation by specifying the ID of the project.
- Mode 2
- Call the AddEditingProject operation to create an online editing project. When calling the operation, specify a timeline for the project or simply leave the timeline empty.
- Call the UpdateEditingProject operation to update the timeline of the project.
- Call the ProduceEditingProjectVideo operation by specifying the ID of the project.
Diverse examples are provided to demonstrate how to use the video editing service, especially how to perform media editing and production by using the timeline. The examples involve the following operations:
Cutting and merging: Merge multiple videos, cut a video with the starting part, ending part, or middle part retained, and merge any parts of multiple videos.
Audio processing: Implement various audio processing scenarios, including muting, audio mixing, audio extraction, volume adjustment, and dubbing.
Image overlay: Overlay an image on one or more videos from the start time to the end time of the entire videos or in the specified time interval.
Text overlay: Overlay text on a video from the start time to the end time of the entire video or in the specified time interval.