Merge multiple audio segments into a single continuous file by calling the CreateMediaConvertTask API of Intelligent Media Management (IMM). Audio merging is suited for music production, audio post-production, and combining lecture or course segments for distribution.

Supported formats
| Category | Formats |
|---|---|
| Audio | AAC, MP3, WAV, FLAC, WMA, AC3, Opus |
| Video | MP4, MPEG-TS, MKV, MOV, AVI, FLV, M3U8, WebM, WMV, RM, VOB |
Prerequisites
Before you begin, make sure that you have:
An AccessKey pair. For more information, see Create an AccessKey pair
An Object Storage Service (OSS) bucket. For more information, see Create a bucket
IMM activated. For more information, see Activate IMM
An IMM project in the same region as your OSS bucket. For more information, see Create a project
Note: Create a project by calling CreateProject, or list existing projects by calling ListProjects.
Merge audio files
This section walks through the two-step process: upload your audio files to OSS, then call the CreateMediaConvertTask API to merge them.
Step 1: Upload your audio files to OSS
Upload the audio files to a bucket in the region where your IMM project is located. Use the OSS console or the OSS SDK.

Step 2: Create an audio merging task
Call the CreateMediaConvertTask API to merge the uploaded files.
Key parameters
| Parameter | Description |
|---|---|
ProjectName | The name of your IMM project. |
Sources | An ordered array of input file URIs. Files are concatenated in the order listed. |
AlignmentIndex | The 0-based index of the primary media file in the Sources array. The primary file provides the default transcoding parameters, such as resolution and frame rate, for the output. The default value is 0. |
Targets | Output configuration including the container format and media encoding settings. For audio merging, the key audio settings are codec, bitrate, sample rate, and channel count. |
Targets[].URI | The OSS path for the output file. Use {autoext} to let IMM set the file extension automatically based on the container format. |
Notification | (Optional) Configure a Simple Message Queue (formerly MNS) topic to receive a notification when the task completes. |
Note: Try the API with pre-filled parameters in OpenAPI Explorer to generate SDK sample code. Adjust the parameters to match your requirements before running in production.
For more information about media processing capabilities, see Media transcoding.
Examples
Merge three segments into an AAC file
Concatenate an intro, main content, and outro into a single AAC audio file. The primary file is the second source file (index 1).
Configuration summary:
| Setting | Value |
|---|---|
| Input files | head.mp3, test.mp3, tail.mp3 |
| Alignment index | 1 (primary file: test.mp3) |
| Output codec | AAC |
| Bitrate | 96 Kbit/s |
| Channels | 2 (stereo) |
| Sample rate | 44.1 kHz |
| Output format | AAC |
| Notification | Simple Message Queue topic test-mns-topic |
For the SDK sample code, visit OpenAPI Explorer. Adjust the parameters before running.
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 segments into an MP3 file
Concatenate two audio files into a single MP3 file. The primary file is the first source file (index 0).
Configuration summary:
| Setting | Value |
|---|---|
| Input files | test.mp3, test1.mp3 |
| Alignment index | 0 (primary file: test.mp3) |
| Output codec | MP3 |
| Bitrate | 128 Kbit/s |
| Channels | 2 (stereo) |
| Sample rate | 44.1 kHz |
| Output format | MP3 |
| Notification | Simple Message Queue topic test-mns-topic |
For the SDK sample code, visit OpenAPI Explorer. Adjust the parameters before running.
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}"
}
]
}