FFmpeg 6.0 or later is required for all audio operations.
AudioTranscodeJob
Converts an audio file to a different format or adjusts its encoding parameters. Go method:Client.AudioTranscode(ctx, job)
Parameters
Path to the source audio file.
Path for the transcoded output file.
Target audio codec. Accepted values:
mp3, aac, opus, vorbis, flac, wav.Target bitrate for lossy codecs. Examples:
"128k", "192k", "320k".Output sample rate in Hz. Common values:
22050, 44100, 48000.Number of output audio channels. Use
1 for mono and 2 for stereo.Quality level for variable bitrate (VBR) encoding. Range:
0–10. Higher values produce better quality. Not all codecs support this parameter.Codec comparison
| Codec | Type | Best for | Notes |
|---|---|---|---|
mp3 | Lossy | General use | Widest device and player compatibility |
aac | Lossy | Music, streaming | Better quality than MP3 at the same bitrate |
opus | Lossy | Speech, podcasts | Best compression for voice; WebRTC standard |
vorbis | Lossy | Open-source projects | Royalty-free alternative to MP3/AAC |
flac | Lossless | Archiving, mastering | No quality loss; larger file size |
wav | Uncompressed | Editing workflows | No encoding; maximum compatibility |