Video Transcoding

Last update:2026-07-15 18:38:32

The Video Transcoding feature converts video files stored in Object Storage from their original format into various target formats. This service allows flexible adjustment of video bitrate, resolution, and encoding methods, ensuring that your video content is compatible with a wide range of devices and provides an optimal viewing experience.

Core Features

  • Versatile Format Support: Supports a wide range of mainstream and professional video and audio formats, as well as codecs.
  • Customizable Parameters: Allows you to define key output video parameters such as bitrate, resolution, and frame rate.
  • Enhanced Compatibility: Ensures that transcoded videos play smoothly on different end-user devices and players.
  • Seamless Integration: Integrates smoothly with Object Storage for convenient management and processing of video resources.

Supported Formats and Codecs

The Atomile Video Transcoding service supports the following file formats and encoding standards:

Category Supported Items
Video Formats MP4, FLV, HLS (m3u8), DASH (mpd), TS, MKV, MOV, WMV, AVI, VP8, VP9, RealVideo, Windows Media Video
Audio Formats AAC, AC-3, MP1, MP2, MP3, PCM, RealAudio, Windows Media Audio (WMA), OGG
Encoding Formats H.266 (VVC), H.265 (HEVC), H.264 (AVC), H.263, MPEG

Transcoding Use Cases

You can use video transcoding in the following scenarios:

  • Transcode on Upload: Automatically or manually trigger transcoding tasks when video files are uploaded to Object Storage.
  • Transcode Existing Videos: Process and transcode video files already stored in Object Storage.
  • Media Processing Workflows: Integrate transcoding into more complex media processing workflows, such as video thumbnail generation and watermarking.

How to Use

Request Structure

Video transcoding operations are defined by setting the fops (file operations) parameter in the request. The fops parameter consists of a series of commands and sub-parameters, concatenated and separated by a forward slash (/).

The general structure is:

<op>/<Format_value>[/param1/<value1>/param2/<value2>...]|saveas/<Urlsafe_Base64_Encoded_Save_Path>

For example, a more detailed structure with common parameters is shown below:

<op>/<Format>
    /r/<value>
    /ab/<value>
    /vb/<value>
    /vcodec/<value>
    /acodec/<value>
    /s/<value>
    /autoscale/<value>
    /autofill/<value>
    /GOPInterval/<value>
    /rotate/<value>
    /an/<value>
    /vn/<value>
    /moovToFront/<value>
    /sar/<value>
    /preset/<value>
|saveas/<Urlsafe_Base64_Encode(bucket:savedfilename)>

Key Points:

  • op: Operation type. For video transcoding, this value must be avthumb.
  • Format: The target output video format, such as mp4 or flv.
  • |saveas/...: This part is required. It specifies the storage location (bucket) and file name for the transcoded file using URL-safe Base64 encoding.

Detailed Parameter Explanation

The following table lists the supported parameters for video transcoding and their descriptions:

Parameter Required Description
op Yes Operation type. For video transcoding, set this to avthumb.
format Yes The target output format. Supported formats include mp4, flv, m3u8 (HLS), mpd (DASH), and others.
r No Video frame rate in frames per second (fps). Common values include 24, 25, and 30.
Note: Dynamic frame rate capture is not supported.
ab No Audio bitrate in bits per second. Common values include 64k, 128k, 192k, 256k, and 320k. For example, 128k means 128 kbps.
vb No Video bitrate in bits per second. Supports dynamic bitrate. Common values include 128k, 1.25m, and 5m. For example, 1.25m means 1.25 Mbps.
vbRatio No Video bitrate coefficient. The output video bitrate is calculated by multiplying the input video bitrate by this coefficient. The supported range is (0, 15], and decimal values are allowed.
Note: If the value is 0 or greater than 15, an error is returned. If the video bitrate calculated using vbRatio exceeds 50 Mbps, this parameter does not take effect. If both vbRatio and vb are configured, vbRatio takes precedence.
vcodec No Specifies the video codec. If not specified, the system attempts to preserve the original codec.
Supported values include:
libx264 - H.264
libvpx - VP8 or VP9
libxvid - MPEG-4
libws265 - H.265
vvc - H.266
acodec No Specifies the audio codec. If not specified, the system attempts to preserve the original codec. Supports MP3, AAC, OGG, and others.
s No Specifies the output video resolution in the format widthxheight (for example, 1920x1080) or by using a preset value.

Width x Height Mode: Sets the exact width and height. If the aspect ratio differs from that of the source video, the image may appear stretched or compressed unless used with autoscale or autofill.

Width or Height Mode: If only one dimension is provided, such as 1280x or x720, the other dimension is calculated automatically while preserving the original aspect ratio.
autoscale No Used with s to control aspect ratio handling:
0 (default): Strictly uses the resolution specified by s, even if it causes image stretching.
1: Scales the video proportionally so that it fits within the dimensions specified by s.
autofill No Used with s to control output dimensions and padding:
1: If the target aspect ratio differs from the source, the source video is scaled proportionally to fit within the specified dimensions, and black bars are added to fill the remaining area so that the final output matches the resolution specified by s.
GOPInterval No Sets the interval between keyframes (I-frames) in milliseconds.
Note: This parameter conflicts with g, which defines the number of frames between keyframes. They cannot be used together.
rotate No Specifies the clockwise rotation angle. Supported values are 90, 180, 270, or auto, which automatically detects and corrects rotation based on video metadata. By default, no rotation is applied.
an No Disables the audio stream:
0 (default): Keeps the audio stream.
1: Removes the audio stream. The output video will not contain audio.
vn No Disables the video stream:
0 (default): Keeps the video stream.
1: Removes the video stream. The output file contains only the audio stream, if present.
moovToFront No Controls the position of the moov atom (metadata) in MP4 files:
0 (default): Keeps metadata at the end of the file.
1: Moves metadata to the beginning of the file, which usually improves streaming startup performance.
sar No Sample Aspect Ratio. Sets a specific pixel aspect ratio such as 1:1 or 1:2. This affects the displayed aspect ratio and usually takes precedence over the aspect ratio implied by s.
/crf/<value> No Constant Rate Factor (CRF). This is a quality-control mode in which output bitrate adjusts dynamically based on scene complexity to maintain a consistent visual quality. Typical values range from 0 to 51 for H.264/H.265. Lower values result in better quality and larger files, while higher values result in lower quality and smaller files. The recommended range is [18, 28].
level No Sets the H.264/H.265 encoding level. The level defines decoder constraints such as maximum resolution, frame rate, and bitrate. Example values range from 10 (Level 1.0) to 51 (Level 5.1). This parameter is effective only when the video codec is libx264.
pix_fmt No Sets the pixel format, such as yuv420p, yuv422p, or yuv444p. yuv420p is the most common format for web video streaming and provides good compatibility and compression efficiency.
vprofile No Sets the video encoding profile, such as baseline, main, high, high10, high422, or high444, mainly for H.264/H.265. The profile determines which encoding tools are used and affects compression efficiency and compatibility.
maxrate No Maximum bitrate limit for dynamic bitrate, in kbit/s (for example, 1000k) or Mbit/s (for example, 8M; M must be uppercase).
Note: If you use this parameter, you must also specify bufsize.
bufsize No Encoder buffer size, used together with maxrate, in kbit/s or Mbit/s. It defines the decoder buffer size required to validate the video stream.
seiKeep No Determines whether SEI (Supplemental Enhancement Information) is preserved during transcoding:
0 (default): SEI is not preserved.
1: SEI is preserved.
When only remuxing is performed, SEI information is preserved by default.
preset No Mainly used for HLS. Specifies the name of a preset, which is a predefined group of optimized transcoding parameters. You can also provide specific parameters in the request to override individual preset settings. See HLS Presets below for details.
saveas Yes Defines the storage location (bucket) and file name for the transcoded file using URL-safe Base64 encoding, in the format Urlsafe_Base64_Encode(bucket:savedfilename).

Notes:

  • Parameter names and values are case-sensitive.
  • Some parameter combinations may have dependencies or conflicts. Refer to the specific parameter descriptions for details.

HLS Presets

To simplify HLS (m3u8) transcoding configuration, a series of presets is available. Each preset represents an optimized parameter combination.

Type Preset Name Description
Audio audio_32k Audio bitrate: 32 kbps
Audio audio_48k Audio bitrate: 48 kbps
Audio audio_64k Audio bitrate: 64 kbps
Video video_16x9_150k Bitrate: 150 kbps, aspect ratio: 16:9, resolution: approximately 400x224
Video video_16x9_240k Bitrate: 240 kbps, aspect ratio: 16:9, resolution: approximately 400x224
Video video_16x9_440k Bitrate: 440 kbps, aspect ratio: 16:9, resolution: approximately 400x224
Video video_16x9_640k Bitrate: 640 kbps, aspect ratio: 16:9, resolution: approximately 400x224
Video video_4x3_150k Bitrate: 150 kbps, aspect ratio: 4:3, resolution: approximately 400x300
Video video_4x3_240k Bitrate: 240 kbps, aspect ratio: 4:3, resolution: approximately 400x300
Video video_4x3_440k Bitrate: 440 kbps, aspect ratio: 4:3, resolution: approximately 400x300
Video video_4x3_640k Bitrate: 640 kbps, aspect ratio: 4:3, resolution: approximately 400x300
Video video_150k Bitrate: 150 kbps, preserves the original aspect ratio
Video video_240k Bitrate: 240 kbps, preserves the original aspect ratio
Video video_440k Bitrate: 440 kbps, preserves the original aspect ratio
Video video_640k Bitrate: 640 kbps, preserves the original aspect ratio
Video video_1000k Bitrate: 1000 kbps, preserves the original aspect ratio
Video video_1500k Bitrate: 1500 kbps, preserves the original aspect ratio

Note: The preset resolution may be adjusted according to the characteristics of the source video to preserve its aspect ratio.

Examples

Example 1: MP4 to FLV

This example transcodes a video named test.mp4 stored in the Object Storage bucket vod-test001 to FLV format. The video bitrate is set to 128k. The transcoded file is named test_file.flv and saved in the same bucket.

Parameter Combination (fops):
avthumb/flv/vb/128k|saveas/Urlsafe_Base64_Encode(vod-test001:test_file.flv)

Pseudo-code Request (curl):

curl -v -X POST \
  --data "bucket=Urlsafe_Base64_Encode(vod-test001)&key=Urlsafe_Base64_Encode(test.mp4)&fops=Urlsafe_Base64_Encode(avthumb/flv/vb/128k|saveas/Urlsafe_Base64_Encode(vod-test001:test_file.flv))&force=1&separate=1" \
  --header "Authorization: AccessKey:EncodeSign" \
  --url "http://mgrDomain/fops"

Actual Request (Base64 Encoded):

curl -v -X POST \
  -d "bucket=dm9kLXdjcy10ZXN0MDAx&key=dGVzdC5tcDQ=&fops=YXZ0aHVtYi9mbHYvdmIvMTI4a3xzYXZlYXMvZG05a0xYZGpjeTEwWlhOME1EQXhPblJsYzNSZlptbHNaUzVtYkhZPQ==&force=1&separate=1" \
  -H "Authorization: AccessKey:EncodeSign" \
  --url "http://mgrDomain/fops"

Example 2: MP4 to HLS Using a Preset

This example transcodes a video named test.mp4 in the Object Storage bucket vod-test001 to HLS format, generating an .m3u8 manifest file and corresponding .ts segments. The example uses the video_16x9_150k preset, which typically includes the following settings:

  • Bitrate: 150 kbps
  • Aspect ratio: 16:9
  • Resolution: approximately 400x224, or adjusted based on the source video

The main transcoded .m3u8 file is named test.m3u8 and saved in the same bucket.

Parameter Combination (fops):
avthumb/m3u8/preset/video_16x9_150k|saveas/Urlsafe_Base64_Encode(vod-test001:test.m3u8)

Pseudo-code Request (curl):

curl -v -X POST \
  --data "bucket=Urlsafe_Base64_Encode(vod-test001)&key=Urlsafe_Base64_Encode(test.mp4)&fops=Urlsafe_Base64_Encode(avthumb/m3u8/preset/video_16x9_150k|saveas/Urlsafe_Base64_Encode(vod-test001:test.m3u8))&force=1&separate=1" \
  --header "Authorization: AccessKey:EncodeSign" \
  --url "http://mgrDomain/fops"

Actual Request (Base64 Encoded):

curl -v -X POST \
  -d "bucket=dm9kLXdjcy10ZXN0MDAx&key=dGVzdC5tcDQ=&fops=YXZ0aHVtYi9tM3U4L3ByZXNldC92aWRlb18xNng5XzE1MGt8c2F2ZWFzL2RtOWtMWGRqY3kxMFpYTjBNREF4T25SbGMzUXViVE4xT0E9PQ==&force=1&separate=1" \
  -H "Authorization: AccessKey:EncodeSign" \
  --url "http://mgrDomain/fops"