How-to Generate Multiple Outputs from an Input

Before you start

This guide assumes that you understand the basics of making a Transcode API request. We recommend completing the Getting Started with Transcoding Media guide first.

Generate multiple outputs

This guide shows you how to use the Media Transcode API to create multiple output files in several formats from a single input. As an example, you might want to generate the following output files from a single API call:

  • a high-bitrate MP4
  • a low-bitrate MP4
  • an audio-only MP3
  • a thumbnail image PNG for a poster-frame

The input could be a single media file or a series of files to be stitched or concatenated together. See our guides on How to Stitch/Concatenate Multiple Files or How to Trim a Media File for more detail on those operations. Specifying outputs is independent of the input definition.

Adding another output file for the API to generate is as simple as adding another output definition to the outputs array of your request.

Example

Here's an example outputs array that demonstrates creating our example outputs in a single API call. In this example, we assume that your own cloud storage has been configured. Read more in our Media Input and Output guide for specific examples.

{
    "inputs": [{ "source" : "s3://dolbyio/public/shelby/airplane.original.mp4" }],
    "outputs": [
        {
            "id" : "my-high-bitrate",
            "destination" : {
                "ref" : "my-cloud-storage",
                "filename" :  "my-high-bitrate-output.mp4"
            },
            "kind" : "mp4",
            "video" : {
                "codec" : "h264",
                "height" : 1080,
                "bitrate_mode" : "vbr",
                "bitrate_kb" : 6000
            },
            "audio" : [{
                "codec" : "aac_lc",
                "bitrate_kb" : 128
            }]
        },
        {
            "id" : "my-proxy-version",
            "destination" : {
                "ref" : "my-cloud-storage",
                "filename" :  "my-proxy-output.mp4"
            },
            "kind" : "mp4",
            "video" : {
                "codec" : "h264",
                "height" : 1080,
                "bitrate_mode" : "vbr",
                "bitrate_kb" : 2500
            },
            "audio" : [{
                "codec" : "aac_lc",
                "bitrate_kb" : 64
            }]
        },
        {
            "id" : "my-audio-only-mp3",
            "destination" : {
                "ref" : "my-cloud-storage",
                "filename" :  "my-audio-only.mp3"
            },
            "kind" : "mp3",
            "audio" : {
                "codec" : "mp3",
                "bitrate_kb" : 64
            }
        },
        {
            "id" : "my-poster-image",
            "destination" : {
                "ref" : "my-cloud-storage",
                "filename" :  "my-poster-image.jpg"
            },
            "kind" : "jpg",
            "image": {
                "height": 360,
                "offset_sec": 10
           }
        }
    ],
    "storage": [
        {
            "id": "my-cloud-storage",
            "bucket": {
                "url": "s3://my-s3-bucket/output/",
                "auth": {
                    "key": "AKIASZXXXXXXXXYLWWUHQ",
                    "secret": "kjYK54XXXXXXXXXZtKFySioE+3"
                }
            }
        }
    ]
}