This topic describes how to use the Intelligent Media Services (IMS) SDK to call the SubmitMediaProducingJob operation to edit audio and video materials together.
Feature description
Batch editing
Batch editing allows you to produce different video clips from given audio and video materials.
Scenarios
In the 5G era, more sellers market their products and services by using short-form videos. For example, sellers may cooperate with key opinion leaders (KOLs) on short-form video platforms to connect to more potential customers. To prevent video content theft, mainstream short-form video platforms apply video content deduplication mechanisms that block videos with the same content and structure from being posted to different accounts on the same platform. Batch editing helps create differentiating video content from similar input information. You can change the Timeline parameter settings in the SubmitMediaProducingJob operation based on your batch editing requirements.
Pricing
When you submit an editing and composition job, you might be charged for multiple items. For more information, see Intelligent production.
Usage notes
You can produce a video from one or more videos, audio files, images, and subtitle materials by configuring Timeline parameters and calling the SubmitMediaProducingJob operation.
A timeline is created when you add materials and configure effects to create a video. A timeline consists of tracks, materials, and effects.
Intelligent production supports editing and compositing, effect rendering, and template-based production for live streams, VOD files, and materials from Object Storage Service (OSS). For more information, see Intelligent production.
Prerequisites
IMS is activated. For more information, see Activate IMS.
A Resource Access Management (RAM) user is created and an AccessKey pair is obtained. For more information, see Create a RAM user and grant permissions to the RAM user.
Step 1: Create an OSS bucket
Log on to the OSS console. In the left-side navigation pane, click Buckets. On the Buckets page, click Create Bucket. In the Create Bucket panel, specify a bucket name, select China (Shanghai) for Region, and click Create. The bucket will be used to store the output videos later.
Step 2: Run batch editing code
Prepare your development environment:
Use Windows 8.1 or later, macOS, or Linux.
Download and install IntelliJ IDEA 2020.1 or later.
Use Java Development Kit (JDK) 1.8 or later.
Create a Maven project and run the code.
Import third-party dependencies.
NoteThe version number of the server SDK introduced in the following sample code is for reference only. To obtain the latest version, visit the SDK page.
<dependencies> <dependency> <groupId>com.aliyun</groupId> <artifactId>ice20201109</artifactId> <version>2.3.0</version> </dependency> <dependency> <groupId>com.alibaba</groupId> <artifactId>fastjson</artifactId> <version>1.2.9</version> </dependency> </dependencies>
Include the AccessKey ID and AccessKey secret in the configuration file. For more information, see Manage access credentials.Manage access credentials
NoteFor information about how to manage access credentials, see Manage access credentials.
Create a Java class and copy and paste the following sample code.
Set bucket in the code to the name of the bucket that you created previously.
Run the sample code to produce videos. The sample code implements the following process:
Timeline creation > Submission of video compositing tasks > Task status polling > Log printing
When the task status is Success, open the file in the returned outputMediaUrl to preview the video. If the access control list (ACL) of the bucket is private, the returned URL of the output video cannot be opened. You need to generate a signed URL of the video in the OSS console and then use the signed URL to access the object.
To change the number of output videos, change the value of the produceCount parameter. You can replace input material provided in the sample code with your actual information. For more information, see Timeline configurations.
References
What to do next
You can use the Timeline parameters to mix videos and images. For more information, see Edit images and videos.
You can use the Timeline parameters to process audio data. For more information, see Audio processing.
You can use the Timeline parameters to process subtitles and subtitle templates. For more information, see Subtitles and subtitle templates.
You can use the Timeline parameters to configure transitions, visual effects, and filters. For more information, see Transitions, visual effects, and filters.
You can use the Timeline parameters to process data and use processed data for video compositing. For more information, see Produce a video after intelligent data processing.
You can use the Timeline parameters to configure other settings. For more information, see Other settings.