Last update:2025-04-11 14:30:40
Video Transcoding converts videos stored in Object Storage from their original format to various formats with different bitrates, resolutions, and codecs. This service ensures your videos are compatible across multiple devices, providing optimal viewing experiences for all users.
CDNetworks supports the following formats and codecs:
Category | Supported Formats |
---|---|
Video formats | MP4, FLV, HLS, DASH, 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 |
Codecs | H.266, H.265, H.264, H.263, MPEG |
You can run transcoding operations:
Use the following structure for your fops
parameter in the request body:
<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)>
Parameter | Required | Description |
---|---|---|
op |
Yes | The operation type. For video transcoding, use avthumb . |
format |
Yes | The target output format. Supports mp4, flv, m3u8, mpd, and others. |
r |
No | Video frame rate in frames per second. Commonly used values: 24, 25, 30. Note: Does not support dynamic frame rates. |
ab |
No | Audio bitrate in bits per second (bit/s). Common values: 64k, 128k, 192k, 256k, 320k. |
vb |
No | Video bitrate in bits per second (bit/s). Supports dynamic bitrate. Common values: 128k, 1.25m, 5m. |
vcodec |
No | Video codec to use. If not specified, maintains the original codec. Options: • libx264 - H.264• libvpx - VP8 and VP9 (Google codecs)• libxvid - MPEG-4• libws265 - H.265• vvc - H.266 |
acodec |
No | Audio codec to use. If not specified, maintains the original codec. Supports MP3, AAC, OGG, and others. |
s |
No | Specifies the output resolution in width x height format (e.g., 1920x1080) or using preset values.Width and Height mode: If both width and height are provided, the transcoder uses these exact dimensions. Note: If the aspect ratio differs from the original, the video may appear stretched. Width or Height mode: If only one dimension is provided (e.g., 1280x or x720 ), the transcoder maintains the original aspect ratio. For example, a 1920x1080 video with the value 1280x becomes 1280x720. |
autoscale |
No | Works with the s parameter to control aspect ratio handling:• 0 (default) - Strictly follows the specified resolution dimensions, even if it causes stretching• 1 - Maintains the original aspect ratio within the specified dimensions |
autofill |
No | Works with the s parameter to control video output dimensions:• 1 - Adds black bars (letterboxing/pillarboxing) to maintain aspect ratio while filling the target dimensions |
GOPInterval |
No | Sets the time between keyframes in milliseconds (ms). Note: This conflicts with the g parameter that defines number of frames between keyframes. |
rotate |
No | Specifies the clockwise rotation angle: 90, 180, 270, or auto for automatic detection. Default: no rotation. |
an |
No | Controls audio track: • 0 (default) - Keep audio track• 1 - Remove audio track |
vn |
No | Controls video stream: • 0 (default) - Keep video stream• 1 - Remove video stream |
moovToFront |
No | Controls placement of the moov atom (metadata) in MP4 files:• 0 (default) - Keep metadata at the end• 1 - Move metadata to beginning for faster streaming startup |
sar |
No | Sets a specific aspect ratio (e.g., 1:1). Overrides the resolution parameter. For example, with resolution 720x720 and SAR 1:2, the final video will be 720x1440. |
preset |
No | Uses a pre-configured bundle of transcoding settings. You can override specific preset parameters by adding them to your request. See the HLS Presets table below. |
saveas |
No | Defines the output location and filename as a URL-safe Base64-encoded string: Urlsafe_Base64_Encode(bucket:savedfilename) |
Type | Preset | Description |
---|---|---|
Audio | audio_32k |
Audio bitrate: 32k |
Audio | audio_48k |
Audio bitrate: 48k |
Audio | audio_64k |
Audio bitrate: 64k |
Video | video_16x9_150k |
Bitrate: 150K, Aspect ratio: 16:9, Resolution: 400x224 |
Video | video_16x9_240k |
Bitrate: 240K, Aspect ratio: 16:9, Resolution: 400x224 |
Video | video_16x9_440k |
Bitrate: 440K, Aspect ratio: 16:9, Resolution: 400x224 |
Video | video_16x9_640k |
Bitrate: 640K, Aspect ratio: 16:9, Resolution: 400x224 |
Video | video_4x3_150k |
Bitrate: 150K, Aspect ratio: 4:3, Resolution: 400x300 |
Video | video_4x3_240k |
Bitrate: 240K, Aspect ratio: 4:3, Resolution: 400x300 |
Video | video_4x3_440k |
Bitrate: 440K, Aspect ratio: 4:3, Resolution: 400x300 |
Video | video_4x3_640k |
Bitrate: 640K, Aspect ratio: 4:3, Resolution: 400x300 |
Video | video_150k |
Bitrate: 150K, Maintains original aspect ratio |
Video | video_240k |
Bitrate: 240K, Maintains original aspect ratio |
Video | video_440k |
Bitrate: 440K, Maintains original aspect ratio |
Video | video_640k |
Bitrate: 640K, Maintains original aspect ratio |
Video | video_1000k |
Bitrate: 1000K, Maintains original aspect ratio |
Video | video_1500k |
Bitrate: 1500K, Maintains original aspect ratio |
This example transcodes a video named test.mp4
from the vod-wcs-test001
bucket to FLV format with a 128K bitrate.
Pseudocode format:
curl -v -X POST
–d "bucket=Urlsafe_Base64_Encode(vod-wcs-test001)&key=Urlsafe_Base64_Encode(test.mp4)&fops=Urlsafe_Base64_Encode(avthumb/flv/vb/128k|saveas/Urlsafe_Base64_Encode(vod-wcs-test001:test_file.flv))&force=1&separate=1"
–H "Authorization:AccessKey:EncodeSign"
--url "http://mgrDomain/fops"
Actual request:
curl -v -X POST
-d "bucket=dm9kLXdjcy10ZXN0MDAx&key=dGVzdC5tcDQ=&fops=YXZ0aHVtYi9mbHYvdmIvMTI4a3xzYXZlYXMvZG05a0xYZGpjeTEwWlhOME1EQXhPblJsYzNSZlptbHNaUzVtYkhZPQ==&force=1&separate=1"
-H "Authorization:AccessKey:EncodeSign"
--url "http://mgrDomain/fops"
This example transcodes a video named test.mp4
to HLS format using a preset with specific parameters:
Pseudocode format:
curl -v -X POST
–d "bucket=Urlsafe_Base64_Encode(vod-wcs-test001)&key=Urlsafe_Base64_Encode(test.mp4)&fops=Urlsafe_Base64_Encode(avthumb/m3u8/preset/video_16x9_150k|saveas/Urlsafe_Base64_Encode(vod-wcs-test001:test.m3u8))&force=1&separate=1"
–H "Authorization:AccessKey:EncodeSign"
--url "http://mgrDomain/fops"
Actual request:
curl -v -X POST
-d "bucket=dm9kLXdjcy10ZXN0MDAx&key=dGVzdC5tcDQ=&fops=YXZ0aHVtYi9tM3U4L3ByZXNldC92aWRlb18xNng5XzE1MGt8c2F2ZWFzL2RtOWtMWGRqY3kxMFpYTjBNREF4T25SbGMzUXViVE4xT0E9PQ==&force=1&separate=1"
-H "Authorization:Authorization:AccessKey:EncodeSign"
--url "http://mgrDomain/fops"