All Products
Search
Document Center

Intelligent Media Management:Audio merging

Last Updated:Feb 27, 2026

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.

image

Supported formats

CategoryFormats
AudioAAC, MP3, WAV, FLAC, WMA, AC3, Opus
VideoMP4, MPEG-TS, MKV, MOV, AVI, FLV, M3U8, WebM, WMV, RM, VOB

Prerequisites

Before you begin, make sure that you have:

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.

image

Step 2: Create an audio merging task

Call the CreateMediaConvertTask API to merge the uploaded files.

Key parameters

ParameterDescription
ProjectNameThe name of your IMM project.
SourcesAn ordered array of input file URIs. Files are concatenated in the order listed.
AlignmentIndexThe 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.
TargetsOutput 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[].URIThe 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:

SettingValue
Input fileshead.mp3, test.mp3, tail.mp3
Alignment index1 (primary file: test.mp3)
Output codecAAC
Bitrate96 Kbit/s
Channels2 (stereo)
Sample rate44.1 kHz
Output formatAAC
NotificationSimple 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:

SettingValue
Input filestest.mp3, test1.mp3
Alignment index0 (primary file: test.mp3)
Output codecMP3
Bitrate128 Kbit/s
Channels2 (stereo)
Sample rate44.1 kHz
Output formatMP3
NotificationSimple 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}"
    }
  ]
}

References