Skip to Content

Use static MP4 and M4A renditions

Learn how to create downloadable MP4 and M4A files from your videos for offline playback, social media sharing, transcription services, and legacy device support.

This guide covers using static_renditions to create MP4 files, which replaces the deprecated mp4_support method. While mp4_support continues to function, we recommend using static_renditions for all new implementations.

For details on the older method, see enabling static mp4 renditions using mp4_support.

What are static MP4 and M4A renditions?

Static renditions are downloadable versions of your video assets in MPEG-4 video (.mp4) or audio (.m4a) format. These files are created alongside the default HLS streaming format and can be used for downloading or streaming the content.

Static renditions allow you to create downloadable files that can be used for:

  • Supporting very old devices, like Android < v4.0 (Less than 1% of Android users)
  • Supporting assets that are very short in duration (e.g., < 10s) on certain platforms
  • Embedding a video in Open Graph cards for sharing on sites like Facebook and Twitter
  • Downloading videos for offline viewing

It also allows users to download M4A audio files, which may be useful for:

  • Feeding into transcription services
  • Delivering a streamable audio-only file to an audio element
  • Downloading an audio-only file, useful for things like podcasts

In the majority of other cases, you'll want to use our default HLS (.m3u8) format, which provides a better viewing experience by dynamically adjusting the quality level to the viewer's connection speed. The HLS version of a video will also be ready sooner than the MP4 versions, if time-to-ready is important.

How video quality affects static renditions

Static renditions are created at the same quality level (Basic, Plus, or Premium) as your original Mux video, and will be either the highest quality video rendition possible or an audio-only version. For videos with multiple versions at the highest resolution (which can happen with Premium quality), we'll use the highest quality version available.

How to enable static renditions

There are several points in an asset's lifecycle where you can enable static renditions. You can enable them when initially creating an asset, add them later to an existing asset, or configure them as part of a direct upload. The method you choose will depend on your workflow and when you determine you need the static renditions.

During asset creation

You can add static renditions to an asset when creating an assetAPI by including the "static_renditions": [] array parameter and specifying a { "resolution": <option> } object as an array element for each static rendition that should be created.

The supported options are:

  • highest: Produces an MP4 file with the video resolution up to 4K (2160p).
  • audio-only: Produces an M4A (audio-only MP4) file for a video asset.

One or both options can be specified.

  • For an audio-only asset: The audio-only rendition option will produce an M4A file and highest is skipped.
  • For a video-only asset: The highest rendition option will produce an MP4 file and audio-only is skipped.

Here's an example of creating an asset with static_renditions specified using the highest and audio-only options:

// POST /video/v1/assets
{
  "input": "https://storage.googleapis.com/muxdemofiles/mux.mp4",
  "playback_policy": [
    "public"
  ],
  "static_renditions" : [ 
    {
      "resolution" : "highest"
    },
    {
      "resolution" : "audio-only"
    }
  ]
}

After asset creation

You can add static renditions to existing assets retroactively by calling the create static rendition APIAPI, as shown below. The create static rendition API will need to be called for each static rendition you would like to add to the asset.

// POST /video/v1/assets/{ASSET_ID}/static-renditions
{
  "resolution" : "highest"
}

During direct upload

To enable static renditions for direct upload, you need to specify the same static_renditions field within new_asset_settings, as shown below:

// POST /video/v1/uploads
{
  "cors_origin": "https://example.com/",
  "new_asset_settings": {
    "playback_policy": [
      "public"
    ],
    "static_renditions" : [ 
      {
        "resolution" : "highest"
      }
    ]
  }
}

During live stream creation

Static renditions can be created from the recorded version of a live stream. This is useful if you want to create downloadable files from a live stream soon after the live stream is finished.

If you want to enable static renditions from the recorded version of a future live stream soon after the live stream is finished, use the static_renditions property in the new_asset_settings when creating the live streamAPI.

// POST /video/v1/live-streams
{
  "playback_policy": "public",
  "new_asset_settings": {
    "playback_policy": "public",
    "static_renditions" : [
      {
        "resolution" : "highest"
      }
    ]
  }
}

After live stream creation

To update the static renditions that are configured to be created from the recorded version of a future live stream, use the update live stream static renditions APIAPI..

// PUT /video/v1/live-streams/{LIVE_STREAM_ID}/new-asset-settings/static-renditions
{
  "static_renditions" : [
    {
      "resolution" : "highest"
    },
    {
      "resolution" : "audio-only"
    }
  ]
}

Access static renditions

After adding static renditions, you'll see an additional key on the asset object called static_renditions. This is the object that will contain the information about which static renditions are available.

{
  ...all asset details...
  "static_renditions" : [
    {
      "id" : "ABC123",
      "type" : "standard",
      "status" : "preparing",
      "resolution" : "highest",
      "name" : "highest.mp4",
      "ext":"mp4"
    },
    {
      "id" : "GHI678",
      "type" : "standard",
      "status" : "preparing",
      "resolution" : "audio-only",
      "name" : "audio.m4a",
      "ext":"m4a"
    }
  ]
}

Static rendition status

Static renditions take longer to create than our default HLS version of the video, so they will not be ready immediately when the asset status is ready.

The static_renditions[].status parameter refers to the current status of processing for each of the static renditions. Instead each static rendition will be ready when its static_renditions[].status is ready, and a video.asset.static_rendition.ready webhook is fired.

You can build the streaming URL by combining the playback ID with the name of the static rendition. The URL follows this pattern:

https://stream.mux.com/{PLAYBACK_ID}/{STATIC_RENDITION_NAME}

The name field in each static rendition object (like highest.mp4 or audio.m4a) is what you'll use as the STATIC_RENDITION_NAME.

ex. https://stream.mux.com/abcd1234/highest.mp4
ex. https://stream.mux.com/abcd1234/audio.m4a

If you want a browser to download the MP4 or M4A file rather than attempt to stream it, you can provide a file name for the static rendition to save it via the download query parameter:

https://stream.mux.com/{PLAYBACK_ID}/{STATIC_RENDITION_NAME}?download={SAVED_FILE_NAME}

For example, if you want to save the highest.mp4 file as cats.mp4, you can use the following URL:

ex. https://stream.mux.com/abcd1234/highest.mp4?download=cats

Remove static renditions

From an asset

To remove static renditions from an asset, you can use the delete static rendition APIAPI. You call the delete static rendition API with the id for each rendition to remove from the asset. The static rendition files will be deleted when they are removed from an asset.

// DELETE /video/v1/asset/{ASSET_ID}/static-renditions/{STATIC_RENDITION_ID}

To completely disable static renditions on an asset, delete all of the static renditions configured on the asset.

From future live streams

To remove the static renditions that are configured to be created from the recorded version of a future live stream, use the delete live stream static renditions APIAPI.

// DELETE /video/v1/live-streams/{LIVE_STREAM_ID}/new-asset-settings/static-renditions

Webhooks

Your application can be automatically updated with the status of static renditions for an asset through webhooks.

There are five events you can receive, which can be fired for each individual static rendition.

WebhookDescription
video.asset.static_rendition.createdEmitted when a static rendition entry is created and the file is being prepared.
video.asset.static_rendition.readyEmitted when a static rendition is ready to be downloaded.
video.asset.static_rendition.erroredEmitted when a static rendition fails to be generated.
video.asset.static_rendition.skippedEmitted when a static rendition is skipped because the requested resolution conflicts with the asset metadata. For example, specifying audio-only for a video-only asset or highest for an audio-only asset.
video.asset.static_rendition.deletedEmitted when an individual static rendition is deleted. Note: This event is not emitted when the parent asset is deleted.

Signed static rendition URLs

Mux videos have two types of playback policy, public or signed. If your playback_id is signed, you will need to also sign requests made for MP4 URLs.

You can check out how to do that in our signed URLs guide.

If you run into any trouble signing requests, please reach out to Mux Support and we'll be able to help.

Migrate from the deprecated mp4_support parameter

Previously, MP4 support was specified using the mp4_support parameter on an asset. This method continues to work though it has been deprecated and new functionality will use the static_renditions array.

The mp4_support parameter and the static_renditions array cannot be used at the same time on an asset.

To use the static_renditions array with assets that have MP4 support enabled using mp4_support, you need to first use the update asset MP4 support APIsAPI, setting mp4_support to none to remove the mp4_support. Then you can create the static renditions individually as described above.

// PUT /video/v1/assets/{ASSET_ID}/mp4-support
{
  "mp4_support": "none"
}

Similarly, the mp4_support parameter cannot be used if an asset has existing static_renditions specified. Delete the static renditions and the legacy mp4_support parameter can be enabled.

Pricing

Asset Quality LevelEncoding CostStorage CostDelivery Cost
Plus & PremiumFreeFreeSame as HLS delivery
BasicFreeStorage fees applySame as HLS delivery

Was this page helpful?