This topic describes how to use the media transcoding operations of Intelligent Media Management (IMM) to transcode audio files.
Feature introduction
Audio transcoding is a technology that converts audio from one format to another. The purpose is to improve the compatibility of audio files and reduce file sizes without compromising audio quality.

Scenarios
Audio format compatibility: Different devices and players may support different audio formats. Transcoding ensures that audio files can be played normally on target devices.
Audio streaming media: In live streaming or streaming media services, audio format transcoding can effectively optimize transmission efficiency to adapt to different network conditions and user devices.
Audio compression: To save storage space or bandwidth, audio files often need to be transcoded into more efficient or compressed formats, such as converting WAV format to MP3 or AAC format.
Parameter adjustment: Adjust the sample rate and number of sound channels according to requirements.
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 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.
NoteYou can call the CreateProject operation to create a project.
You can call the ListProjects operation to list all project information in the specified region.
Step 1: Upload files
Use the OSS console to upload media files to a bucket in the same region as your IMM project.

Step 2: Use IMM audio transcoding
Call the CreateMediaConvertTask operation to create an audio transcoding task.
Parameter examples
The following examples use the IMM project test-project for audio transcoding.
For more information about media processing features and usage, see Media transcoding.
You can process audio files through the media transcoding operations using the OpenAPI Explorer. You can refer to the SDK code.
Transcode audio to AAC format
Transcoding information
Input file path: oss://test-bucket/video-demo/test.mp3
Encoding format: mp3 → aac
Audio configuration: 96 Kbps bitrate, dual channel, 44.1 kHz sample rate
Output audio save path: oss://test-bucket/video-demo/test.aac
Transcoding completion notification: Send MNS message to MNS topic "test-mns-topic"
For SDK examples, see OpenAPI Explorer. The example parameters have been automatically filled in for you. You can modify them as needed before debugging.
Request parameters
{
"ProjectName": "test-project",
"Notification": {
"MNS": {
"TopicName": "test-mns-topic"
}
},
"Sources": [
{
"Subtitles": [],
"URI": "oss://test-bucket/video-demo/test.mp3"
}
],
"Targets": [
{
"Audio": {
"TranscodeAudio": {
"Bitrate": 96000,
"Channel": 2,
"Codec": "aac",
"SampleRate": 44100
}
},
"Container": "aac",
"URI": "oss://test-bucket/video-demo/test.{autoext}"
}
]
}Transcode audio to MP3 format
Transcoding information
Input file path: oss://test-bucket/video-demo/test.aac
Encoding format: aac → mp3
Audio configuration: 128 Kbps bitrate, dual channel, 44.1 kHz sample rate
Output audio save path: oss://test-bucket/video-demo/test.mp3
Transcoding completion notification: Send MNS message to MNS topic "test-mns-topic"
For SDK examples, see OpenAPI Explorer. The example parameters have been automatically filled in for you. You can modify them as needed before debugging.
Request parameters
{
"ProjectName": "test-project",
"Notification": {
"MNS": {
"TopicName": "test-mns-topic"
}
},
"Sources": [
{
"URI": "oss://test-bucket/video-demo/test.aac"
}
],
"Targets": [
{
"Audio": {
"TranscodeAudio": {
"Bitrate": 128000,
"Channel": 2,
"Codec": "mp3",
"SampleRate": 44100
}
},
"Container": "mp3",
"URI": "oss://test-bucket/video-demo/test.{autoext}"
}
]
}Extract audio from video
Extract a single audio track from a video and save it as an independent audio file without changing the sample rate and number of sound channels.
Transcoding information
Input file path: oss://test-bucket/video-demo/test.mp4
Audio configuration: Extract a single audio stream from the video and convert it to AAC encoding format
Output audio save path: oss://test-bucket/video-demo/test-audio-%d.aac
Transcoding completion notification: Send MNS message to MNS topic "test-mns-topic"
For SDK examples, see OpenAPI Explorer. The example parameters have been automatically filled in for you. You can modify them as needed before debugging.
Request parameters
{
"ProjectName": "test-project",
"Notification": {
"MNS": {
"TopicName": "test-mns-topic"
}
},
"Sources": [
{
"URI": "oss://test-bucket/video-demo/test.mp4"
}
],
"Targets": [
{
"Audio": {
"TranscodeAudio": {
"Codec": "aac"
}
},
"Container": "aac",
"URI": "oss://test-bucket/video-demo/test-audio-{streamindex}.{autoext}"
}
]
}If there are multiple audio tracks to extract from the file, save them as independent audio files without changing the sample rate and number of sound channels.
Transcoding information:
Input file path: oss://test-bucket/video-demo/test.mp4
Audio configuration: Extract all audio streams from the video, convert to AAC encoding format, 256 Kbps bitrate
Output audio save path: oss://test-bucket/video-demo/test-audio-%d.aac
Transcoding completion notification: Send MNS message to MNS topic "test-mns-topic"
For SDK examples, see OpenAPI Explorer. The example parameters have been automatically filled in for you. You can modify them as needed before debugging.
Request parameters:
{
"ProjectName": "test-project",
"Notification": {
"MNS": {
"TopicName": "test-mns-topic"
}
},
"Sources": [
{
"URI": "oss://test-bucket/video-demo/test.mp4"
}
],
"Targets": [
{
"Audio": {
"Stream": [
101
],
"TranscodeAudio": {
"Bitrate": 256000,
"Codec": "aac"
}
},
"Container": "aac",
"URI": "oss://test-bucket/video-demo/test-audio-{streamindex}.{autoext}"
}
]
}