How-to Specify the Output File Format of your Music Master
Before you start
This guide assumes that you understand the basics of making a Music Mastering API request. We recommend completing the Getting Started with the Music Mastering API guide first.
Specify your music master output format
When you create a music master with the Music Mastering API, you can specify the output file format you want your master to be delivered in. The output file format is specified using the kind
parameter within the outputs
array. The kind
parameter sets the container of the output file. When you choose the preferred output container for your music, the audio codec, channel count, sample rate, bit rate, and bit depth are automatically set.
Create multiple output files
You can create up to five output files and specify an output file format for each based on your music distribution requirements. You can choose one Mastering profile, along with your preferred intensity, loudness, and stereo enhancement settings that are applied to each output file. To add another output file for the Music Mastering API to generate, simply add another output definition to the outputs
array of your request.
If you would like to try out different mastering profiles and settings before you create your music master files, you can learn more about the settings in the Music Mastering API guide and try out the Music Mastering Preview API in the API reference.
Supported Music Master output containers
This table shows the output containers supported by the Music Mastering API that you can choose, along with the details that are automatically set by the Music mastering API.
Some compressed formats (for example, OGG and MP3) cannot inherit higher sample rates. The outputs are fixed to a 48kHz sampling rate.
Output Container | Codec | Sample Rate | Bit Rate |
---|---|---|---|
WAV | PCM | same as input | - same as input if input is lossless - 1536 kbps when input is lossy |
OGG | Vorbis | 48kHz | 256 kbps |
MP3 | MPEG Audio | 48kHz | 320 kbps |
MP4 | AAC LC | same as input | 256 kbps |
AAC | AAC LC | same as input | 256 kbps |
Code example
This code example shows you how to specify multiple music master outputs with different output formats. In the outputs
array, you can specify the output container using the kind
parameter.
import os
import requests
# Add your API token as an environmental variable or hard coded value.
api_token = os.getenv("DOLBYIO_API_TOKEN", "your_token_here")
# The master configurations have to be the same across all outputs.
master_configuration = {
"dynamic_eq": {"preset": "c", "intensity": 90},
"loudness": {"target_level": -14},
"stereo_image": {"enable": True}
}
body = {
"inputs": [{"source": "dlb://in/example.wav"}],
"outputs": [
{
"destination": "dlb://out/example-mastered.aac",
"master": master_configuration,
"kind": "aac",
},
{
"destination": "dlb://out/example-mastered.mp3",
"master": master_configuration,
"kind": "mp3",
},
{
"destination": "dlb://out/example-mastered.mp4",
"master": master_configuration,
"kind": "mp4",
},
{
"destination": "dlb://out/example-mastered.ogg",
"master": master_configuration,
"kind": "ogg",
},
{
"destination": "dlb://out/example-mastered.wav",
"master": master_configuration,
"kind": "wav",
},
],
}
url = "https://api.dolby.com/media/master"
headers = {
"Authorization": "Bearer {0}".format(api_token),
"Content-Type": "application/json",
"Accept": "application/json"
}
response = requests.post(url, json=body, headers=headers)
response.raise_for_status()
print(response.json())
// Add your API token as an environmental variable or hard coded value.
const api_token = process.env.DOLBYIO_API_TOKEN || "your_token_here";
// The master configurations have to be the same across all outputs.
const axios = require("axios").default;
const master_config = {
dynamic_eq: { preset: "c", intensity: 90 },
loudness: { target_level: -14 },
stereo_image: { enable: true },
};
const config = {
method: "post",
url: "https://api.dolby.com/media/master",
headers: {
Authorization: `Bearer ${api_token}`,
"Content-Type": "application/json",
Accept: "application/json",
},
data: {
inputs: [{ source: "dlb://in/example.wav" }],
outputs: [
{
destination: "dlb://out/example-mastered.aac",
master: master_config,
kind: "aac",
},
{
destination: "dlb://out/example-mastered.mp3",
master: master_config,
kind: "mp3",
},
{
destination: "dlb://out/example-mastered.mp4",
master: master_config,
kind: "mp4",
},
{
destination: "dlb://out/example-mastered.ogg",
master: master_config,
kind: "ogg",
},
{
destination: "dlb://out/example-mastered.wav",
master: master_config,
kind: "wav",
},
],
},
};
axios(config)
.then(function (response) {
console.log(response.data.job_id);
})
.catch(function (error) {
console.log(error);
});
# Add your API token as an environmental variable or hard coded value.
API_TOKEN=${DOLBYIO_API_TOKEN:-"your_token_here"}
# The master configurations have to be the same across all outputs.
master_config='{
"dynamic_eq": {"preset": "c", "intensity": 90},
"loudness": {"target_level": -14},
"stereo_image" : {"enable": true}
}'
curl -X POST https://api.dolby.com/media/master \
--header "Authorization: Bearer $API_TOKEN" \
--header "Content-Type: application/json" \
--data '{
"inputs": [{"source": "dlb://in/example.wav"}],
"outputs": [
{
"destination": "dlb://out/example-mastered.aac",
"master": '"$master_config"',
"kind": "aac"
},
{
"destination": "dlb://out/example-mastered.mp3",
"master": '"$master_config"',
"kind": "mp3"
},
{
"destination": "dlb://out/example-mastered.mp4",
"master": '"$master_config"',
"kind": "mp4"
},
{
"destination": "dlb://out/example-mastered.ogg",
"master": '"$master_config"',
"kind": "ogg"
},
{
"destination": "dlb://out/example-mastered.wav",
"master": '"$master_config"',
"kind": "wav"
}
]
}'
Updated 3 months ago