The /audio/encode Robot

Our /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.

The /audio/encode Robot's 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

Example use cases featuring the /audio/encode robot

See the robot in action with some live demos and code samples right here on our website:

High-quality MP3 encoding

Here you can see a quick example of the Assembly Instructions required to create this encoding pipeline. More information is available in the Live demo

{
 "steps": {
    "mp3": {
      "use": ":original",
      "robot": "/audio/encode",
      "result": true,
      "preset": "mp3",
      "ffmpeg_stack": "v2.2.3"
    }
  }
}

Encode to OGG with custom FFmpeg parameters

Here you can see a quick example of the Assembly Instructions required to create this encoding pipeline. More information is available in the Live demo

{
 "steps": {
    "ogg": {
      "use": ":original",
      "robot": "/audio/encode",
      "result": true,
      "ffmpeg_stack": "v2.2.3",
      "preset": "ogg"
    }
  }
}

Encoding with a specific bit rate

Here you can see a quick example of the Assembly Instructions required to create this encoding pipeline. More information is available in the Live demo

{
 "steps": {
    "my_audio_encoding": {
      "use": ":original",
      "robot": "/audio/encode",
      "result": true,
      "ffmpeg_stack": "v2.2.3",
      "sample_rate": 44100,
      "bitrate": 256000
    }
  }
}

Generate a waveform image from an audio file

Here you can see a quick example of the Assembly Instructions required to create this encoding pipeline. More information is available in the Live demo

{
 "steps": {
    "wav": {
      "use": ":original",
      "robot": "/audio/encode",
      "preset": "wav",
      "ffmpeg_stack": "v2.2.3"
    },
    "waveform": {
      "robot": "/audio/waveform",
      "use": "wav",
      "result": true,
      "width": 300,
      "height": 200,
      "background_color": "ffffffff",
      "outer_color": "ff0000aa",
      "center_color": "660000aa"
    }
  }
}

Merge multiple audio streams

Here you can see a quick example of the Assembly Instructions required to create this encoding pipeline. More information is available in the Live demo

{
 "steps": {
    "squashed_audio_channels": {
      "use": ":original",
      "robot": "/audio/encode",
      "ffmpeg_stack": "v2.2.3",
      "preset": "flac",
      "ffmpeg": {
        "ac": 1
      },
      "result": true
    }
  }
}


Did you know?

You can easily combine Robots to create powerful workflows, unique to your business.

This is the power of Transloadit.