Merge multiple audio clips into a single file by calling the media transcoding API of Intelligent Media Management (IMM).
Overview
Audio merging combines multiple audio clips into a single, continuous audio file. You can select, edit, and blend different audio materials to create expressive and natural-sounding audio.

Use cases
-
Music production: Audio merging integrates tracks, voices, or sections from different instruments into a complete musical piece, enhancing flexibility and creativity.
-
Audio editing and post-production: Audio merging helps editors streamline content from news reports, documentaries, and other audio programs to improve coherence and listenability.
-
Education and training: Merge segments of courses or lectures to create educational audio materials that are easy for students to study and review.
Supported audio and video formats
|
Category |
Format |
|
Audio |
Mainstream audio formats, such as AAC, MP3, WAV, FLAC, WMA, AC3, and Opus. |
|
Video |
Mainstream video formats, such as MP4, MPEG-TS, MKV, MOV, AVI, FLV, M3U8, WebM, WMV, RM, and VOB. |
Procedure
Prerequisites
-
An AccessKey pair is created and obtained. For more information, see Create an AccessKey pair.
-
Object Storage Service (OSS) is activated and a bucket is created. For more information, see Create a bucket.
-
IMM is activated. For more information, see Activate IMM.
-
A project is created in the IMM console. For more information, see Create a project.
Note-
You can call the CreateProject operation to create a project. For more information, see CreateProject.
-
You can call the ListProjects operation to list information of all projects in a region.
-
Step 1: Upload files
Use the OSS console to upload your media files to a bucket in the same region as your IMM project.
On the upload page, click Scan for Files to select your local media files.
Step 2: Use IMM to merge audio
Call the CreateMediaConvertTask API to create an audio merging task.
Examples
The following examples show how to merge audio by using the IMM project test-project. For more information, see media transcoding.
You can use OpenAPI Explorer to call the media transcoding API to process your files. For more information, see the SDK examples.
Merge audio with an intro and outro
-
Input files:
oss://test-bucket/video-demo/head.mp3,oss://test-bucket/video-demo/test.mp3, andoss://test-bucket/video-demo/tail.mp3 -
AlignmentIndex: 1
-
Audio configuration: AAC codec, 96 Kbps bitrate, 2-channel, 44.1 kHz sample rate
-
Output format: aac
-
Output file path:
oss://test-bucket/video-demo/concat.aac -
Notification: Send a message to the MNS topic "test-mns-topic"
For SDK examples, see OpenAPI Explorer. The example parameters are pre-filled. Modify them as needed and then run the request.
Request parameters:
{
"ProjectName": "test-project",
"AlignmentIndex": 1,
"Notification": {
"MNS": {
"TopicName": "test-mns-topic"
}
},
"Sources": [
{
"URI": "oss://test-bucket/video-demo/head.mp3"
},
{
"URI": "oss://test-bucket/video-demo/test.mp3"
},
{
"URI": "oss://test-bucket/video-demo/tail.mp3"
}
],
"Targets": [
{
"Audio": {
"TranscodeAudio": {
"Bitrate": 96000,
"Channel": 2,
"Codec": "aac",
"SampleRate": 44100
}
},
"Container": "aac",
"URI": "oss://test-bucket/video-demo/concat.{autoext}"
}
]
}Merge two audio segments to MP3
Input files:
oss://test-bucket/video-demo/test.mp3andoss://test-bucket/video-demo/test1.mp3AlignmentIndex: 0
Audio configuration: MP3 codec, 128 Kbps bitrate, 2-channel, 44.1 kHz sample rate
Output format: mp3
Output file path:
oss://test-bucket/video-demo/concat.mp3Notification: Send a message to the MNS topic "test-mns-topic"
For SDK examples, see OpenAPI Explorer. The example parameters are pre-filled. Modify them as needed and then run the request.
Request parameters:
{
"ProjectName": "test-project",
"AlignmentIndex": 0,
"Notification": {
"MNS": {
"TopicName": "test-mns-topic"
}
},
"Sources": [
{
"URI": "oss://test-bucket/video-demo/test.mp3"
},
{
"URI": "oss://test-bucket/video-demo/test1.mp3"
}
],
"Targets": [
{
"Audio": {
"TranscodeAudio": {
"Bitrate": 128000,
"Channel": 2,
"Codec": "mp3",
"SampleRate": 44100
}
},
"Container": "mp3",
"URI": "oss://test-bucket/video-demo/concat.{autoext}"
}
]
}