This topic describes how to merge videos using the media transcoding feature of Intelligent Media Management (IMM).
Overview
Video merging lets you combine multiple video clips into a single output file and convert it to your desired format.

Use cases
-
Film and television production: Video merging is a core part of producing movies, TV series, and short films. It lets editors combine shots and scenes to build a complete narrative.
-
Content creation: On social media platforms, creators use video merging to produce vlogs, tutorials, or themed compilations, making their content more engaging and watchable.
-
Education and training: Instructors can merge various video clips to create comprehensive teaching materials that combine theory with practical examples, improving student comprehension.
-
Sports broadcasting: In sports, video merging is used to create highlight reels that let viewers relive the most exciting moments of a game.
Supported audio and video formats
Category | Format |
Audio | All mainstream formats, such as AAC, MP3, WAV, FLAC, WMA, AC3, and OPUS. |
Video | All mainstream formats, such as MP4, MPEG-TS, MKV, MOV, AVI, FLV, M3U8, WebM, WMV, RM, and VOB. |
Procedure
Prerequisites
Create an AccessKey. For more information, see Create an AccessKey.
Activate Object Storage Service (OSS) and create a bucket. For more information, see Create a bucket.
Activate Intelligent Media Management (IMM). For more information, see Activate IMM.
Create a project in the IMM console. For more information, see Create a project.
NoteYou can also call an API operation to create a project. For more information, see Create a project.
You can call the ListProjects operation to list all projects that are created in a specified 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, keep the default File ACL of Inherit from Bucket, and click Scan File to select your media files.
Step 2: Start a media transcoding task
Call the CreateMediaConvertTask operation to create a media transcoding task.
Examples
The following examples show how to merge videos in the IMM project named test-project.
For more information about media processing features, see Media transcoding.
-
You can use OpenAPI Explorer to call the media transcoding API, debug requests, and view SDK sample code.
Merge an intro, main video, and outro
-
Input video file paths:
oss://test-bucket/video-demo/head.mov,oss://test-bucket/video-demo/winemaking.mov, andoss://test-bucket/video-demo/tail.mov -
Main media file index: 1
-
Video settings: H.264 encoding, CRF of 24, and a frame rate of 25 fps.
-
Audio settings: AAC format, a 96 Kbps bitrate, 2-channel stereo, and a sample rate of 44.1 kHz.
-
Output video format: MP4
-
Output file path:
oss://test-bucket/video-demo/concat.mp4 -
Task completion notification: Send a message to the MNS topic "test-mns-topic".
Go to OpenAPI Explorer to find an SDK sample with these request parameters pre-filled. You can modify them as needed and run the request online.
Request parameters
{
"ProjectName": "test-project",
"AlignmentIndex": 1,
"Notification": {
"MNS": {
"TopicName": "test-mns-topic"
}
},
"Sources": [
{
"URI": "oss://test-bucket/video-demo/head.mov"
},
{
"URI": "oss://test-bucket/video-demo/winemaking.mov"
},
{
"URI": "oss://test-bucket/video-demo/tail.mov"
}
],
"Targets": [
{
"Audio": {
"TranscodeAudio": {
"Bitrate": 96000,
"Channel": 2,
"Codec": "aac",
"SampleRate": 44100
}
},
"Container": "mp4",
"URI": "oss://test-bucket/video-demo/concat.{autoext}",
"Video": {
"TranscodeVideo": {
"CRF": 24,
"Codec": "h264",
"FrameRate": 25,
"PixelFormat": "yuv420p"
}
}
}
]
}Merge two videos into a 720p video
Input video file paths:
oss://test-bucket/video-demo/winemaking.movandoss://test-bucket/video-demo/shushan-commercial-building.movMain media file index: 0
Video settings: H.264 encoding, CRF of 25, 25 fps, and a resolution of 1280x720. The video is scaled to fit and letterboxed (black bars are added). For more information, see Resize methods.
Audio settings: AAC format, a 96 Kbps bitrate, 2-channel stereo, and a sample rate of 44.1 kHz.
Output video format: MP4
Output file path:
oss://test-bucket/video-demo/concat.mp4Task completion notification: Send a message to the MNS topic "test-mns-topic".
Go to OpenAPI Explorer to find an SDK sample with these request parameters pre-filled. You can modify them as needed and run the request online.
Request parameters
{
"ProjectName": "test-project",
"AlignmentIndex": 0,
"Notification": {
"MNS": {
"TopicName": "test-mns-topic"
}
},
"Sources": [
{
"URI": "oss://test-bucket/video-demo/winemaking.mov"
},
{
"URI": "oss://test-bucket/video-demo/shushan-commercial-building.mov"
}
],
"Targets": [
{
"Audio": {
"TranscodeAudio": {
"Bitrate": 96000,
"Channel": 2,
"Codec": "aac",
"SampleRate": 44100
}
},
"Container": "mp4",
"URI": "oss://test-bucket/video-demo/concat.{autoext}",
"Video": {
"TranscodeVideo": {
"AdaptiveResolutionDirection": true,
"CRF": 25,
"Codec": "h264",
"FrameRate": 25,
"PixelFormat": "yuv420p",
"Resolution": "x720",
"ScaleType": "fill"
}
}
}
]
}