The /audio/encode Robot

Transloadit offers a variety of features to reduce audio size while maintaining quality, as well as add effects like loops or watermarks.

The /audio/encode Robot converts audio files into all kinds of formats for you. We provide encoding presets for the most common formats.

Parameters

Name Type Default Description
preset String "mp3" Performs conversion using pre-configured settings. If you specify your own FFmpeg parameters using the Robot's ffmpeg parameter and you have not specified a preset, then the default mp3 preset is not applied. This is to prevent you from having to override each of the mp3 preset's values manually. For a list of audio presets, see audio presets.
bitrate Integer Auto Bit rate of the resulting audio file, in bits per second. If not specified will default to the bit rate of the input audio file
sample_rate Integer Auto Sample rate of the resulting audio file, in Hertz. If not specified will default to the sample rate of the input audio file

Live demos

Our /audio/encode Robot can be used in combination with other Robots, to create powerful workflows unique to your use case.
Here are a few example scenarios, and the required the Assembly Instructions to implement them.
You can also try demos of these examples right here, live on our website.

High-quality FLAC encoding

{
  "steps": {
    "flac_encoded": {
      "use": [":original"],
      "robot": "/audio/encode",
      "result": true,
      "ffmpeg_stack": "v2.2.3",
      "preset": "flac"
    },
    "exported": {
      "use": ["flac_encoded", ":original"],
      "robot": "/s3/store",
      "bucket": "demos.transloadit.com",
      "bucket_region": "us-east-1",
      "key": "YOUR_AWS_KEY",
      "secret": "YOUR_AWS_SECRET"
    }
  }
}

High-quality MP3 encoding

{
  "steps": {
    "mp3_encoded": {
      "use": [":original"],
      "robot": "/audio/encode",
      "result": true,
      "ffmpeg_stack": "v2.2.3",
      "preset": "mp3"
    },
    "exported": {
      "use": ["mp3_encoded", ":original"],
      "robot": "/s3/store",
      "bucket": "demos.transloadit.com",
      "bucket_region": "us-east-1",
      "key": "YOUR_AWS_KEY",
      "secret": "YOUR_AWS_SECRET"
    }
  }
}

Encode to OGG with custom FFmpeg parameters

{
  "steps": {
    "ogg_encoded": {
      "use": [":original"],
      "robot": "/audio/encode",
      "result": true,
      "ffmpeg": {"q:a":-1,"b:a":62000,"ar":22000},
      "ffmpeg_stack": "v3.3.3",
      "preset": "ogg"
    },
    "exported": {
      "use": ["ogg_encoded", ":original"],
      "robot": "/s3/store",
      "bucket": "demos.transloadit.com",
      "bucket_region": "us-east-1",
      "key": "YOUR_AWS_KEY",
      "secret": "YOUR_AWS_SECRET"
    }
  }
}

Encoding with a specific bit rate

{
  "steps": {
    "bitrate_adjusted": {
      "use": [":original"],
      "robot": "/audio/encode",
      "result": true,
      "bitrate": 256000,
      "ffmpeg_stack": "v2.2.3",
      "sample_rate": 44100
    },
    "exported": {
      "use": ["bitrate_adjusted", ":original"],
      "robot": "/s3/store",
      "bucket": "demos.transloadit.com",
      "bucket_region": "us-east-1",
      "key": "YOUR_AWS_KEY",
      "secret": "YOUR_AWS_SECRET"
    }
  }
}

Downmix multiple audio streams into one

{
  "steps": {
    "squashed_audio_channels": {
      "use": [":original"],
      "robot": "/audio/encode",
      "result": true,
      "ffmpeg": {"ac":1},
      "ffmpeg_stack": "v3.3.3",
      "preset": "mp3"
    },
    "exported": {
      "use": ["squashed_audio_channels", ":original"],
      "robot": "/s3/store",
      "bucket": "demos.transloadit.com",
      "bucket_region": "us-east-1",
      "key": "YOUR_AWS_KEY",
      "secret": "YOUR_AWS_SECRET"
    }
  }
}

Extract a 10 second clip from audio

{
  "steps": {
    "shortened": {
      "use": [":original"],
      "robot": "/audio/encode",
      "result": true,
      "ffmpeg": {"ss":"00:00:5.0", "t":10},
      "ffmpeg_stack": "v3.3.3",
      "preset": "mp3"
    },
    "exported": {
      "use": ["shortened", ":original"],
      "robot": "/s3/store",
      "bucket": "demos.transloadit.com",
      "bucket_region": "us-east-1",
      "key": "YOUR_AWS_KEY",
      "secret": "YOUR_AWS_SECRET"
    }
  }
}

Our /audio/encode robot blog posts

Over the years we wrote the following posts about Our /audio/encode robot on our blog:

Did you know?

You can easily combine Robots to create powerful workflows, unique to your business.
This is the power of Transloadit.