Last update:2025-03-21 14:52:19
Audio Transcoding allows you to convert audio files to different formats, adjust quality settings, and modify channel layouts. This service helps you optimize audio files for sharing, ensure compatibility across devices, or customize output for specific requirements.
CDNetworks supports a wide range of media formats:
Video Formats:
Audio Formats:
Codecs:
Structure your fops
command as shown below:
<op>/<Format>
/an/<value>
/vn/<value>
/acodec/<value>
/volume/<value>
/loudnorm/<value>
/aq/<value>
/ab/<value>
/ar/<value>
/ac/<value>
|saveas/<Urlsafe_Base64_Encode(bucket:filekey)>
Parameter | Required | Description |
---|---|---|
op |
Yes | Operation type. Use avthumb for audio transcoding. |
format |
Yes | Target format (mp3, aac, wma, etc.) |
an |
No | Audio track control: • 0 (default) - Keep audio track• 1 - Remove audio track |
vn |
No | Video stream control: • 0 (default) - Keep video stream• 1 - Remove video stream |
acodec |
No | Audio codec selection (MP3, AAC, OGG, etc.). If not specified, the output maintains the original codec. |
volume |
No | Audio volume adjustment: By multiples: Range 0-2 where: • 0 - Silence• 1 - Original volume• 2 - Double volume• 1.5 - 1.5× original volumeBy decibels: Range -10dB to 10dB where: • Negative values decrease volume • Positive values increase volume Note: High settings may cause distortion |
loudnorm |
No | Target loudness in LUFS (Loudness Units relative to Full Scale): • Range: -70 to -5 LUFS• Lower values (closer to -70) produce quieter output • Higher values (closer to -5) produce louder output Important: Not recommended to use with volume parameterFormat restrictions: • For eac3 : Must set ar to 48000, 44100, or 32000• For ac3 : Must set ar to 48000 or 44100 |
aq |
No | Audio quality: • MP3: Range 0-9 (lower is better) • AAC: Range 10-500 (higher is better) Notes: 1. Currently supports only MP3 and AAC 2. Cannot be used with ab parameter |
ab |
No | Audio bitrate in bits/second (e.g., 64k, 128k, 192k, 256k, 320k) |
ar |
No | Audio sampling frequency in Hertz (e.g., 8000, 12050, 22050, 44100) Note: FLV format only supports 44100, 22050, and 11025 Hz |
ac |
No | Audio channel layout: • 1 - Mono (single-channel)• 2 - Stereo (dual-channel) |
saveas |
No | Output location as URL-safe Base64-encoded string: Urlsafe_Base64_Encode(bucket:savedfilename) |
This example extracts audio from test.mp4
in the vod-wcs-test001
bucket. The video stream is removed, leaving only a 64 kbps MP3 audio file named test_audio.mp3
in the same bucket.
Pseudocode:
curl -v -X POST
–d "bucket=Urlsafe_Base64_Encode(vod-wcs-test001)&key=Urlsafe_Base64_Encode(test.mp4)&fops=Urlsafe_Base64_Encode(avthumb/mp3/acodec/libmp3lame/ab/64k|saveas/Urlsafe_Base64_Encode(vod-wcs-test001:test_audio.mp3))&force=1&separate=1"
–H "Authorization:mgrAuthorization_A:mgrAuthorization_B"
--url "http://mgrDomain/fops"
Actual Request:
curl -v -X POST
-d "bucket=dm9kLXdjcy10ZXN0MDAx&key=dGVzdC5tcDQ=&fops=YXZ0aHVtYi9tcDMvYWNvZGVjL2xpYm1wM2xhbWUvYWIvNjRrfHNhdmVhcy9kbTlrTFhkamN5MTBaWE4wTURBeE9uUmxjM1JmWVhWa2FXOHViWEF6&force=1&separate=1"
-H "Authorization:mgrAuthorization_A:mgrAuthorization_B"
--url "http://mgrDomain/fops"