更新时间:2024-01-09 15:20:40
Audio Transcoding lets you change the format, quality, and channels of your audio files stored on Object Storage. This makes them smaller for sharing, compatible with different devices, or tailored to your needs.
At CDNetworks, we accommodate a wide range of video and audio formats and codecs, including the following:
Transcoding can be executed while uploading the video to Object Storage, on existing videos within Object Storage, or simultaneously with other media processing operations.
Structure your fops
in the request body as follows:
<op>/<Format>
/an/<value>
/vn/<value>
/acodec/<value>
/loudnorm/<value>
/aq/<value>
/ab/<value>
/ar/<value>
/ac/<value>
|saveas/<Urlsafe_Base64_Encode(bucket:filekey)>
Audio Transcoding Fops Parameters
Parameter | Required | Description |
---|---|---|
op | Yes | Operation type. For Audio Transcoding, set the operation type to avthumb . |
format | Yes | Target format for output, supports mp3, aac, wma, etc. |
an | No | Remove the audio track. Set to 0 to keep it, or 1 to remove it. The default setting is 0. |
vn | No | Remove the video stream. Set to 0 to keep it, or 1 to remove it. The default setting is 0. |
acodec | No | Audio codecs, the transcoding supports a variety of formats including MP3, AAC, OGG, and more. If no specific codec is selected, the output audio will maintain the same codec as the original. |
volume | No | Configure the audio volume. This supports adjustments by multiples and by decibels:By multiples: The range for multiple adjustments is from 0 to 2. Here, 0 stands for silence, 1 maintains the original sound, 2 doubles the volume, and 1.5 increases the volume to 1.5 times its original level.By decibels: For adjustments in decibels, the recommended setting is between -10dB and 10dB. Negative values represent a decrease in volume, while positive values indicate an increase. Be cautious as setting the volume too high may result in audio distortion. |
loudnorm | No | Set target loudness for the video in Loudness Units relative to Full Scale (LUFS). The valid range is -70 LUFS to -5 LUFS. A lower negative value (closer to -70) corresponds to a quieter sound, while a value nearer to -5 represents a louder sound. Using this parameter in conjunction with the volume parameter is not recommended, as it may lead to unintended loudness shifts or distortions.Note: 1. For eac3 : The ar parameter must be set. The only acceptable values are: 48000, 44100, or 32000.2. For ac3 : The ar parameter must be set as well. The only acceptable values are: 48000 or 44100. |
aq | No | The audio quality. It ranges from 0-9 for MP3, where a smaller value indicates higher quality. For AAC, the range is 10-500, with larger values indicating higher quality. Please note:1. The audio quality adjustment only supports MP3 and AAC currently. 2. The audio quality parameter cannot be used in conjunction with the ab parameter. |
ab | No | Audio bitrate, unit: bits per second (bit/s). Common bitrates: 64k, 128k, 192k, 256k, 320k, etc. |
ar | No | Audio sampling frequency:, unit: Hertz (Hz). Common sampling frequencies: 8000, 12050, 22050, and 44100 Hz.Note: The FLV only supports audio sampling frequencies of 44100, 22050, and 11025 Hz. |
ac | No | Configure the channel layout of the output audio: 1 for single-channel (mono) output or 2 for dual-channel (stereo) output. |
saveas | No | This parameter defines the output location and filename as a URL-safe Base64-encoded string with the pseudocode Urlsafe_Base64_Encode(bucket:savedfilename) . |
This example demonstrates how to extract audio from a video named test.mp4
in the chosen bucket vod-wcs-test001
. The video content will be removed, leaving only the audio stream. The process outputs a audio file, named test_audio.mp3
in MP3 format (64 kbps), which is saved in the same bucket.
Pseudocode format for the request:
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 format:
-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""