Assets
An asset refers to a piece of media content that is stored or is being live streamed through the Mux system. An asset always has a duration and one or more tracks (audio, video, and text data).
The media content of an asset cannot be updated once created, however an asset can be used to create another asset, and can be modified within that process.
Properties
Unique identifier for the Asset. Max 255 characters.
Time the Asset was created, defined as a Unix timestamp (seconds since epoch).
The status of the asset.
The duration of the asset in seconds (max duration for a single asset is 24 hours).
The maximum resolution that has been stored for the asset. The asset may be delivered at lower resolutions depending on the device and bandwidth, however it cannot be delivered at a higher value than is stored.
The maximum frame rate that has been stored for the asset. The asset may be delivered at lower frame rates depending on the device and bandwidth, however it cannot be delivered at a higher value than is stored. This field may return -1 if the frame rate of the input cannot be reliably determined.
The aspect ratio of the asset in the form of width:height
, for example 16:9
.
An array of Playback ID objects. Use these to create HLS playback URLs. See Play your videos for more details.
Unique identifier for the PlaybackID
-
public
playback IDs are accessible by constructing an HLS url likehttps://stream.mux.com/${PLAYBACK_ID}
-
signed
playback IDS should be used with tokenshttps://stream.mux.com/${PLAYBACK_ID}?token={TOKEN}
. See Secure video playback for details about creating tokens.
The individual media tracks that make up an asset.
Unique identifier for the Track
The type of track
The duration in seconds of the track media. This parameter is not set for the text
type track. This field is optional and may not be set. The top level duration
field of an asset will always be set.
The maximum width in pixels available for the track. Only set for the video
type track.
The maximum height in pixels available for the track. Only set for the video
type track.
The maximum frame rate available for the track. Only set for the video
type track. This field may return -1
if the frame rate of the input cannot be reliably determined.
The maximum number of audio channels the track supports. Only set for the audio
type track.
Only set for the audio
type track.
This parameter is set only for the text
type track.
The language code value represents BCP 47 specification compliant value. For example, en
for English or en-US
for the US version of English. This parameter is set for text
type and subtitles
text type track.
The name of the track containing a human-readable description. The hls manifest will associate a subtitle text track with this value. For example, the value is "English" for subtitles text track for the language_code
value of en-US
. This parameter is set for the text
type and subtitles
text type track.
Indicates the track provides Subtitles for the Deaf or Hard-of-hearing (SDH). This parameter is set for the text
type and subtitles
text type track.
Arbitrary metadata set for the track either when creating the asset or track. This parameter is set for text
type and subtitles
text type track. Max 255 characters.
Object that describes any errors that happened when processing this asset.
The type of error that occurred for this asset.
Error messages with more details.
Whether the asset is created from a live stream and the live stream is currently active
and not in idle
state.
Arbitrary metadata set for the asset. Max 255 characters.
Unique identifier for the live stream. This is an optional parameter added when the asset is created from a live stream.
An object containing the current status of Master Access and the link to the Master MP4 file when ready. This object does not exist if master_acess
is set to none
and when the temporary URL expires.
The temporary URL to the master version of the video, as an MP4 file. This URL will expire after 24 hours.
Asset Identifier of the video used as the source for creating the clip.
Normalize the audio track loudness level. This parameter is only applicable to on-demand (not live) assets.
An object containing the current status of any static renditions (mp4s). The object does not exist if no static renditions have been requested. See Download your videos for more information.
Indicates the status of downloadable MP4 versions of this asset.
Array of file objects.
Extension of the static rendition file
The height of the static rendition's file in pixels
The width of the static rendition's file in pixels
The bitrate in bits per second
The file size in bytes
An array of individual live stream recording sessions. A recording session is created on each encoder connection during the live stream
The time at which the recording for the live stream started. The time value is Unix epoch time represented in ISO 8601 format.
The duration of the live stream recorded. The time value is in seconds.
An object containing one or more reasons the input file is non-standard. See the guide on minimizing processing time for more information on what a standard input is defined as. This object only exists on on-demand assets that have non-standard inputs, so if missing you can assume the input qualifies as standard.
The video codec used on the input file. For example, the input file encoded with hevc
video codec is non-standard and the value of this parameter is hevc
.
The audio codec used on the input file. Non-AAC audio codecs are non-standard.
The video key frame Interval (also called as Group of Picture or GOP) of the input file is high
. This parameter is present when the gop is greater than 10 seconds.
The video frame rate of the input file. Video with average frames per second (fps) less than 10 or greater than 120 is non-standard. A -1
frame rate value indicates Mux could not determine the frame rate of the video track.
The video resolution of the input file. Video resolution higher than 2048 pixels on any one dimension (height or width) is considered non-standard, The resolution value is presented as width
x height
in pixels.
The video pixel aspect ratio of the input file.
Video Edit List reason indicates that the input file's video track contains a complex Edit Decision List.
Audio Edit List reason indicates that the input file's audio track contains a complex Edit Decision List.
A catch-all reason when the input file in created with non-standard encoding parameters.
True means this live stream is a test asset. A test asset can help evaluate the Mux Video APIs without incurring any cost. There is no limit on number of test assets created. Test assets are watermarked with the Mux logo, limited to 10 seconds, and deleted after 24 hrs.
Create an assetpost
Create a new Mux Video asset.
curl https://api.mux.com/video/v1/assets \
-X POST \
-d '{ "input": "https://muxed.s3.amazonaws.com/leds.mp4", "playback_policy": ["public"] }' \
-H "Content-Type: application/json" \
-u ${MUX_TOKEN_ID}:${MUX_TOKEN_SECRET}
Request body params
An array of objects that each describe an input file to be used to create the asset. As a shortcut, input can also be a string URL for a file when only one input file is used. See input[].url
for requirements.
The web address of the file that Mux should download and use.
- For subtitles text tracks, the url is the location of subtitle/captions file. Mux supports SubRip Text (SRT) and Web Video Text Tracks format for ingesting Subtitles and Closed Captions.
- For Watermarking or Overlay, the url is the location of the watermark image.
- When creating clips from existing Mux assets, the url is defined with
mux://assets/{asset_id}
template whereasset_id
is the Asset Identifier for creating the clip from.
An object that describes how the image file referenced in url should be placed over the video (i.e. watermarking).
Where the vertical positioning of the overlay/watermark should begin from. Defaults to "top"
The distance from the vertical_align starting point and the image's closest edge. Can be expressed as a percent ("10%") or as a pixel value ("100px"). Negative values will move the overlay offscreen. In the case of 'middle', a positive value will shift the overlay towards the bottom and and a negative value will shift it towards the top.
Where the horizontal positioning of the overlay/watermark should begin from.
The distance from the horizontal_align starting point and the image's closest edge. Can be expressed as a percent ("10%") or as a pixel value ("100px"). Negative values will move the overlay offscreen. In the case of 'center', a positive value will shift the image towards the right and and a negative value will shift it towards the left.
How wide the overlay should appear. Can be expressed as a percent ("10%") or as a pixel value ("100px"). If both width and height are left blank the width will be the true pixels of the image, applied as if the video has been scaled to fit a 1920x1080 frame. If height is supplied with no width, the width will scale proportionally to the height.
How tall the overlay should appear. Can be expressed as a percent ("10%") or as a pixel value ("100px"). If both width and height are left blank the height will be the true pixels of the image, applied as if the video has been scaled to fit a 1920x1080 frame. If width is supplied with no height, the height will scale proportionally to the width.
How opaque the overlay should appear, expressed as a percent. (Default 100%)
The time offset in seconds from the beginning of the video indicating the clip's starting marker. The default value is 0 when not included. This parameter is only applicable for creating clips when input.url
has mux://assets/{asset_id}
format.
The time offset in seconds from the beginning of the video, indicating the clip's ending marker. The default value is the duration of the video when not included. This parameter is only applicable for creating clips when input.url
has mux://assets/{asset_id}
format.
This parameter is required for the text
track type.
Type of text track. This parameter only supports subtitles value. For more information on Subtitles / Closed Captions, see this blog post. This parameter is required for text
track type.
The language code value must be a valid BCP 47 specification compliant value. For example, en for English or en-US for the US version of English. This parameter is required for text type and subtitles text type track.
The name of the track containing a human-readable description. This value must be unique across all text type and subtitles text
type tracks. The hls manifest will associate a subtitle text track with this value. For example, the value should be "English" for subtitles text track with language_code as en. This optional parameter should be used only for text
type and subtitles text
type track. If this parameter is not included, Mux will auto-populate based on the input[].language_code
value.
Indicates the track provides Subtitles for the Deaf or Hard-of-hearing (SDH). This optional parameter should be used for text
type and subtitles text
type tracks.
This optional parameter should be used for text
type and subtitles text
type tracks.
An array of playback policy names that you want applied to this asset and available through playback_ids
. Options include: "public"
(anyone with the playback URL can stream the asset). And "signed"
(an additional access token is required to play the asset). If no playback_policy is set, the asset will have no playback IDs and will therefore not be playable. For simplicity, a single string name can be used in place of the array in the case of only one playback policy.
-
public
playback IDs are accessible by constructing an HLS url likehttps://stream.mux.com/${PLAYBACK_ID}
-
signed
playback IDS should be used with tokenshttps://stream.mux.com/${PLAYBACK_ID}?token={TOKEN}
. See Secure video playback for details about creating tokens.
Arbitrary metadata that will be included in the asset details and related webhooks. Can be used to store your own ID for a video along with the asset. Max: 255 characters.
Specify what level (if any) of support for mp4 playback. In most cases you should use our default HLS-based streaming playback ({playback_id}.m3u8) which can automatically adjust to viewers' connection speeds, but an mp4 can be useful for some legacy devices or downloading for offline playback. See the Download your videos guide for more information.
Normalize the audio track loudness level. This parameter is only applicable to on-demand (not live) assets.
Specify what level (if any) of support for master access. Master access can be enabled temporarily for your asset to be downloaded. See the Download your videos guide for more information.
Marks the asset as a test asset when the value is set to true. A Test asset can help evaluate the Mux Video APIs without incurring any cost. There is no limit on number of test assets created. Test asset are watermarked with the Mux logo, limited to 10 seconds, deleted after 24 hrs.
{
"input": "https://muxed.s3.amazonaws.com/leds.mp4",
"playback_policy": [
"public"
]
}
{
"data": {
"status": "preparing",
"playback_ids": [
{
"policy": "public",
"id": "uNbxnGLKJ00yfbijDO8COxTOyVKT01xpxW"
}
],
"mp4_support": "none",
"master_access": "none",
"id": "SqQnqz6s5MBuXGvJaUWdXuXM93J9Q2yv",
"created_at": "1607452572"
}
}
List assetsget
List all Mux assets.
curl https://api.mux.com/video/v1/assets \
-X GET \
-H "Content-Type: application/json" \
-u ${MUX_TOKEN_ID}:${MUX_TOKEN_SECRET}
Request path & query params
Number of items to include in the response
Offset by this many pages, of the size of limit
{
"data": [
{
"tracks": [
{
"type": "video",
"max_width": 1920,
"max_height": 800,
"max_frame_rate": 24,
"id": "HK01Bq7FrEQmIu3QpRiZZ98HQOOZjm6BYyg17eEunlyo",
"duration": 734.166667
},
{
"type": "audio",
"max_channels": 2,
"max_channel_layout": "stereo",
"id": "nNKHJqw2G9cE019AoK16CJr3O27gGnbtW4w525hJWqWw",
"duration": 734.143991
}
],
"status": "ready",
"playback_ids": [
{
"policy": "public",
"id": "85g23gYz7NmQu02YsY81ihuod6cZMxCp017ZrfglyLCKc"
}
],
"mp4_support": "none",
"max_stored_resolution": "HD",
"max_stored_frame_rate": 24,
"master_access": "none",
"id": "8jd7M77xQgf2NzuocJRPYdSdEfY5dLlcRwFARtgQqU4",
"duration": 734.25,
"created_at": "1609869152",
"aspect_ratio": "12:5"
},
{
"tracks": [
{
"type": "video",
"max_width": 1920,
"max_height": 1080,
"max_frame_rate": 29.97,
"id": "RiyQPM31a1SPtfI802bEP2zD02F5FQVNL801FRHeE5t01G4",
"duration": 23.8238
},
{
"type": "audio",
"max_channels": 2,
"max_channel_layout": "stereo",
"id": "LvINTciHVoC017knMCH01y9pSi5OrDLCRaBPNDAoNJcmg",
"duration": 23.823792
}
],
"status": "ready",
"playback_ids": [
{
"policy": "public",
"id": "vAFLI2eKFFicXX00iHBS2vqt5JjJGg5HV6fQ4Xijgt1I"
}
],
"mp4_support": "none",
"max_stored_resolution": "HD",
"max_stored_frame_rate": 29.97,
"master_access": "none",
"id": "lJ4bGGsp7ZlPf02nMg015W02iHQLN9XnuuLRBsPS00xqd68",
"duration": 23.857167,
"created_at": "1609868768",
"aspect_ratio": "16:9"
}
]
}
Retrieve an assetget
Retrieves the details of an asset that has previously been created. Supply the unique asset ID that was returned from your previous request, and Mux will return the corresponding asset information. The same information is returned when creating an asset.
curl https://api.mux.com/video/v1/assets/${ASSET_ID} \
-X GET \
-H "Content-Type: application/json" \
-u ${MUX_TOKEN_ID}:${MUX_TOKEN_SECRET}
Request path & query params
The asset ID.
{
"data": {
"tracks": [
{
"type": "video",
"max_width": 1920,
"max_height": 1080,
"max_frame_rate": 29.97,
"id": "RiyQPM31a1SPtfI802bEP2zD02F5FQVNL801FRHeE5t01G4",
"duration": 23.8238
},
{
"type": "audio",
"max_channels": 2,
"max_channel_layout": "stereo",
"id": "LvINTciHVoC017knMCH01y9pSi5OrDLCRaBPNDAoNJcmg",
"duration": 23.823792
}
],
"status": "ready",
"playback_ids": [
{
"policy": "public",
"id": "vAFLI2eKFFicXX00iHBS2vqt5JjJGg5HV6fQ4Xijgt1I"
}
],
"mp4_support": "none",
"max_stored_resolution": "HD",
"max_stored_frame_rate": 29.97,
"master_access": "none",
"id": "lJ4bGGsp7ZlPf02nMg015W02iHQLN9XnuuLRBsPS00xqd68",
"duration": 23.857167,
"created_at": "1609868768",
"aspect_ratio": "16:9"
}
}
Delete an assetdel
Deletes a video asset and all its data
curl https://api.mux.com/video/v1/assets/${ASSET_ID} \
-X DELETE \
-H "Content-Type: application/json" \
-u ${MUX_TOKEN_ID}:${MUX_TOKEN_SECRET}
Request path & query params
The asset ID.
Retrieve asset input infoget
Returns a list of the input objects that were used to create the asset along with any settings that were applied to each input.
curl https://api.mux.com/video/v1/assets/${ASSET_ID}/input-info \
-X GET \
-H "Content-Type: application/json" \
-u ${MUX_TOKEN_ID}:${MUX_TOKEN_SECRET}
Request path & query params
The asset ID.
{
"data": [
{
"settings": {
"url": "https://muxed.s3.amazonaws.com/leds.mp4"
},
"file": {
"container_format": "mp4",
"tracks": [
{
"type": "video",
"duration": 120,
"width": 1280,
"height": 720,
"frame_rate": 30,
"encoding": "h.264"
},
{
"type": "audio",
"duration": 120,
"sample_rate": 16000,
"sample_size": 24,
"encoding": "aac"
}
]
}
},
{
"settings": {
"url": "https://exmaple.com/myVideo_en.srt"
},
"file": {
"container_format": "srt"
}
}
]
}
Create a playback IDpost
curl https://api.mux.com/video/v1/assets/${ASSET_ID}/playback-ids \
-X POST \
-d '{ "policy": "public" }' \
-H "Content-Type: application/json" \
-u ${MUX_TOKEN_ID}:${MUX_TOKEN_SECRET}
Request body params
-
public
playback IDs are accessible by constructing an HLS url likehttps://stream.mux.com/${PLAYBACK_ID}
-
signed
playback IDS should be used with tokenshttps://stream.mux.com/${PLAYBACK_ID}?token={TOKEN}
. See Secure video playback for details about creating tokens.
Request path & query params
The asset ID.
{
"policy": "public"
}
{
"data": {
"policy": "public",
"id": "Lj02VZDorh9hCV00flNqPli8fmwf6KEppug01w8zDEYVlQ"
}
}
Retrieve a playback IDget
curl https://api.mux.com/video/v1/assets/${ASSET_ID}/playback-ids/${PLAYBACK_ID} \
-X GET \
-H "Content-Type: application/json" \
-u ${MUX_TOKEN_ID}:${MUX_TOKEN_SECRET}
Request path & query params
The asset ID.
The live stream's playback ID.
{
"data": {
"policy": "public",
"id": "vAFLI2eKFFicXX00iHBS2vqt5JjJGg5HV6fQ4Xijgt1I"
}
}
Delete a playback IDdel
curl https://api.mux.com/video/v1/assets/${ASSET_ID}/playback-ids/${PLAYBACK_ID} \
-X DELETE \
-H "Content-Type: application/json" \
-u ${MUX_TOKEN_ID}:${MUX_TOKEN_SECRET}
Request path & query params
The asset ID.
The live stream's playback ID.
Update MP4 supportput
Allows you to add or remove mp4 support for assets that were created without it. Currently there are two values supported in this request, standard
and none
. none
means that an asset does not have mp4 support, so submitting a request with mp4_support
set to none
will delete the mp4 assets from the asset in question.
curl https://api.mux.com/video/v1/assets/${ASSET_ID}/mp4-support \
-X PUT \
-d '{ "mp4_support": "standard" }' \
-H "Content-Type: application/json" \
-u ${MUX_TOKEN_ID}:${MUX_TOKEN_SECRET}
Request body params
String value for the level of mp4 support
Request path & query params
The asset ID.
{
"mp4_support": "standard"
}
{
"data": {
"tracks": [
{
"type": "video",
"max_width": 1920,
"max_height": 1080,
"max_frame_rate": 29.97,
"id": "RiyQPM31a1SPtfI802bEP2zD02F5FQVNL801FRHeE5t01G4",
"duration": 23.8238
},
{
"type": "audio",
"max_channels": 2,
"max_channel_layout": "stereo",
"id": "LvINTciHVoC017knMCH01y9pSi5OrDLCRaBPNDAoNJcmg",
"duration": 23.823792
}
],
"status": "ready",
"static_renditions": {
"status": "preparing"
},
"playback_ids": [
{
"policy": "public",
"id": "Lj02VZDorh9hCV00flNqPli8fmwf6KEppug01w8zDEYVlQ"
}
],
"mp4_support": "standard",
"max_stored_resolution": "HD",
"max_stored_frame_rate": 29.97,
"master_access": "none",
"id": "lJ4bGGsp7ZlPf02nMg015W02iHQLN9XnuuLRBsPS00xqd68",
"duration": 23.857167,
"created_at": "1609868768",
"aspect_ratio": "16:9"
}
}
Update master accessput
Allows you to add temporary access to the master (highest-quality) version of the asset in MP4 format. A URL will be created that can be used to download the master version for 24 hours. After 24 hours Master Access will revert to "none". This master version is not optimized for web and not meant to be streamed, only downloaded for purposes like archiving or editing the video offline.
curl https://api.mux.com/video/v1/assets/${ASSET_ID}/master-access \
-X PUT \
-d '{ "master_access": "temporary" }' \
-H "Content-Type: application/json" \
-u ${MUX_TOKEN_ID}:${MUX_TOKEN_SECRET}
Request body params
Add or remove access to the master version of the video.
Request path & query params
The asset ID.
{
"master_access": "temporary"
}
{
"data": {
"tracks": [
{
"type": "video",
"max_width": 1920,
"max_height": 1080,
"max_frame_rate": 29.97,
"id": "RiyQPM31a1SPtfI802bEP2zD02F5FQVNL801FRHeE5t01G4",
"duration": 23.8238
},
{
"type": "audio",
"max_channels": 2,
"max_channel_layout": "stereo",
"id": "LvINTciHVoC017knMCH01y9pSi5OrDLCRaBPNDAoNJcmg",
"duration": 23.823792
}
],
"status": "ready",
"playback_ids": [
{
"policy": "public",
"id": "Lj02VZDorh9hCV00flNqPli8fmwf6KEppug01w8zDEYVlQ"
}
],
"mp4_support": "none",
"max_stored_resolution": "HD",
"max_stored_frame_rate": 29.97,
"master_access": "temporary",
"master": {
"status": "preparing"
},
"id": "lJ4bGGsp7ZlPf02nMg015W02iHQLN9XnuuLRBsPS00xqd68",
"duration": 23.857167,
"created_at": "1609868768",
"aspect_ratio": "16:9"
}
}
Create an asset trackpost
curl https://api.mux.com/video/v1/assets/${ASSET_ID}/tracks \
-X POST \
-d '{ "url": "https://example.com/myVIdeo_en.srt", "type": "text", "text_type": "subtitles", "closed_captions": true, "language_code": "en-US", "name": "English", "passthrough": "English" }' \
-H "Content-Type: application/json" \
-u ${MUX_TOKEN_ID}:${MUX_TOKEN_SECRET}
Request body params
The language code value must be a valid BCP 47 specification compliant value. For example, en for English or en-US for the US version of English.
The name of the track containing a human-readable description. This value must be unqiue across all the text type and subtitles text type tracks. HLS manifest will associate subtitle text track with this value. For example, set the value to "English" for subtitles text track with language_code as en-US. If this parameter is not included, Mux will auto-populate based on the language_code value.
Indicates the track provides Subtitles for the Deaf or Hard-of-hearing (SDH).
Arbitrary metadata set for the track either when creating the asset or track.
Request path & query params
The asset ID.
{
"url": "https://example.com/myVideo_en.srt",
"type": "text",
"text_type": "subtitles",
"language_code": "en-US",
"name": "English",
"closed_captions": true,
"passthrough": "English"
}
{
"data": {
"type": "text",
"text_type": "subtitles",
"status": "preparing",
"passthrough": "English",
"name": "English",
"language_code": "en-US",
"id": "xBe7u01029ipxBLQhYzZCJ1cke01zCkuUsgnYtH0017nNzbpv2YcsoMDmw",
"closed_captions": true
}
}
Delete an asset trackdel
curl https://api.mux.com/video/v1/assets/${ASSET_ID}/tracks/${TRACK_ID} \
-X DELETE \
-H "Content-Type: application/json" \
-u ${MUX_TOKEN_ID}:${MUX_TOKEN_SECRET}
Request path & query params
The asset ID.
The track ID.
Live Streams
A Live Stream represents a unique live stream of video being pushed to Mux. It includes configuration details (a Stream Key) for live broadcasting software/hardware and a Playback ID for playing the stream anywhere. Currently, RTMP is the only supported method of ingesting video. Use rtmp://global-live.mux.com:5222/app with the Live Stream's Stream Key for getting the video into Mux, and use https://stream.mux.com with the Live Stream's Playback ID for playback.
A Live Stream can be used once for a specific event, or re-used forever. If you're building an application like Facebook Live or Twitch, you could create one Live Stream per user. This allows them the configure their broadcasting software once, and the Live Stream Playback ID will always show their latest stream.
Each RTMP session creates a new video asset automatically. You can set up a webhook to be notified each time a broadcast (or Live Stream RTMP session) begins or ends with the video.live_stream.active and video.live_stream.idle events respectively. Assets that are created from a Live Stream have the same behavior as other Assets you create.
Learn more about how to go live in our guides.
Properties
Unique identifier for the Live Stream. Max 255 characters.
Time the Live Stream was created, defined as a Unix timestamp (seconds since epoch).
Unique key used for streaming to a Mux RTMP endpoint. This should be considered as sensitive as credentials, anyone with this stream key can begin streaming.
The Asset that is currently being created if there is an active broadcast.
An array of strings with the most recent Assets that were created from this live stream.
idle
indicates that there is no active broadcast. active
indicates that there is an active broadcast and disabled
status indicates that no future RTMP streams can be published.
An array of Playback ID objects. Use these to create HLS playback URLs. See Play your videos for more details.
Unique identifier for the PlaybackID
-
public
playback IDs are accessible by constructing an HLS url likehttps://stream.mux.com/${PLAYBACK_ID}
-
signed
playback IDS should be used with tokenshttps://stream.mux.com/${PLAYBACK_ID}?token={TOKEN}
. See Secure video playback for details about creating tokens.
The settings to be used when creating a new asset. You can use any of the usual settings when creating an asset normally, with the exception to not include file url for creating the asset in input. You could optionally add overlay_setting and input urls to add Subtitles / Captions.
Arbitrary metadata set for the asset. Max 255 characters.
When live streaming software disconnects from Mux, either intentionally or due to a drop in the network, the Reconnect Window is the time in seconds that Mux should wait for the streaming software to reconnect before considering the live stream finished and completing the recorded asset. Min: 0.1s. Max: 300s (5 minutes).
Latency is the time from when the streamer does something in real life to when you see it happen in the player. Set this if you want lower latency for your live stream. Note: Reconnect windows are incompatible with Reduced Latency and will always be set to zero (0) seconds. See the Reduce live stream latency guide to understand the tradeoffs.
Each Simulcast Target contains configuration details to broadcast (or "restream") a live stream to a third-party streaming service. See the Stream live to 3rd party platforms guide.
ID of the Simulcast Target
Arbitrary Metadata set when creating a simulcast target.
The current status of the simulcast target. See Statuses below for detailed description.
idle
: Default status. When the parent live stream is in disconnected status, simulcast targets will be idle state.starting
: The simulcast target transitions into this state when the parent live stream transition into connected state.broadcasting
: The simulcast target has successfully connected to the third party live streaming service and is pushing video to that service.errored
: The simulcast target encountered an error either while attempting to connect to the third party live streaming service, or mid-broadcasting. Compared to other errored statuses in the Mux Video API, a simulcast may transition back into the broadcasting state if a connection with the service can be re-established.
Stream Key represents an stream identifier for the third party live streaming service to simulcast the parent live stream too.
RTMP hostname including the application name for the third party live streaming service.
True means this live stream is a test live stream. Test live streams can be used to help evaluate the Mux Video APIs for free. There is no limit on the number of test live streams, but they are watermarked with the Mux logo, and limited to 5 minutes. The test live stream is disabled after the stream is active for 5 mins and the recorded asset also deleted after 24 hours.
Create a live streampost
curl https://api.mux.com/video/v1/live-streams \
-X POST \
-d '{ "playback_policy": "public", "new_asset_settings": { "playback_policy": "public" } }' \
-H "Content-Type: application/json" \
-u ${MUX_TOKEN_ID}:${MUX_TOKEN_SECRET}
Request body params
-
public
playback IDs are accessible by constructing an HLS url likehttps://stream.mux.com/${PLAYBACK_ID}
-
signed
playback IDS should be used with tokenshttps://stream.mux.com/${PLAYBACK_ID}?token={TOKEN}
. See Secure video playback for details about creating tokens.
An array of objects that each describe an input file to be used to create the asset. As a shortcut, input can also be a string URL for a file when only one input file is used. See input[].url
for requirements.
The web address of the file that Mux should download and use.
- For subtitles text tracks, the url is the location of subtitle/captions file. Mux supports SubRip Text (SRT) and Web Video Text Tracks format for ingesting Subtitles and Closed Captions.
- For Watermarking or Overlay, the url is the location of the watermark image.
- When creating clips from existing Mux assets, the url is defined with
mux://assets/{asset_id}
template whereasset_id
is the Asset Identifier for creating the clip from.
An object that describes how the image file referenced in url should be placed over the video (i.e. watermarking).
Where the vertical positioning of the overlay/watermark should begin from. Defaults to "top"
The distance from the vertical_align starting point and the image's closest edge. Can be expressed as a percent ("10%") or as a pixel value ("100px"). Negative values will move the overlay offscreen. In the case of 'middle', a positive value will shift the overlay towards the bottom and and a negative value will shift it towards the top.
Where the horizontal positioning of the overlay/watermark should begin from.
The distance from the horizontal_align starting point and the image's closest edge. Can be expressed as a percent ("10%") or as a pixel value ("100px"). Negative values will move the overlay offscreen. In the case of 'center', a positive value will shift the image towards the right and and a negative value will shift it towards the left.
How wide the overlay should appear. Can be expressed as a percent ("10%") or as a pixel value ("100px"). If both width and height are left blank the width will be the true pixels of the image, applied as if the video has been scaled to fit a 1920x1080 frame. If height is supplied with no width, the width will scale proportionally to the height.
How tall the overlay should appear. Can be expressed as a percent ("10%") or as a pixel value ("100px"). If both width and height are left blank the height will be the true pixels of the image, applied as if the video has been scaled to fit a 1920x1080 frame. If width is supplied with no height, the height will scale proportionally to the width.
How opaque the overlay should appear, expressed as a percent. (Default 100%)
The time offset in seconds from the beginning of the video indicating the clip's starting marker. The default value is 0 when not included. This parameter is only applicable for creating clips when input.url
has mux://assets/{asset_id}
format.
The time offset in seconds from the beginning of the video, indicating the clip's ending marker. The default value is the duration of the video when not included. This parameter is only applicable for creating clips when input.url
has mux://assets/{asset_id}
format.
This parameter is required for the text
track type.
Type of text track. This parameter only supports subtitles value. For more information on Subtitles / Closed Captions, see this blog post. This parameter is required for text
track type.
The language code value must be a valid BCP 47 specification compliant value. For example, en for English or en-US for the US version of English. This parameter is required for text type and subtitles text type track.
The name of the track containing a human-readable description. This value must be unique across all text type and subtitles text
type tracks. The hls manifest will associate a subtitle text track with this value. For example, the value should be "English" for subtitles text track with language_code as en. This optional parameter should be used only for text
type and subtitles text
type track. If this parameter is not included, Mux will auto-populate based on the input[].language_code
value.
Indicates the track provides Subtitles for the Deaf or Hard-of-hearing (SDH). This optional parameter should be used for text
type and subtitles text
type tracks.
This optional parameter should be used for text
type and subtitles text
type tracks.
An array of playback policy names that you want applied to this asset and available through playback_ids
. Options include: "public"
(anyone with the playback URL can stream the asset). And "signed"
(an additional access token is required to play the asset). If no playback_policy is set, the asset will have no playback IDs and will therefore not be playable. For simplicity, a single string name can be used in place of the array in the case of only one playback policy.
-
public
playback IDs are accessible by constructing an HLS url likehttps://stream.mux.com/${PLAYBACK_ID}
-
signed
playback IDS should be used with tokenshttps://stream.mux.com/${PLAYBACK_ID}?token={TOKEN}
. See Secure video playback for details about creating tokens.
Arbitrary metadata that will be included in the asset details and related webhooks. Can be used to store your own ID for a video along with the asset. Max: 255 characters.
Specify what level (if any) of support for mp4 playback. In most cases you should use our default HLS-based streaming playback ({playback_id}.m3u8) which can automatically adjust to viewers' connection speeds, but an mp4 can be useful for some legacy devices or downloading for offline playback. See the Download your videos guide for more information.
Normalize the audio track loudness level. This parameter is only applicable to on-demand (not live) assets.
Specify what level (if any) of support for master access. Master access can be enabled temporarily for your asset to be downloaded. See the Download your videos guide for more information.
Marks the asset as a test asset when the value is set to true. A Test asset can help evaluate the Mux Video APIs without incurring any cost. There is no limit on number of test assets created. Test asset are watermarked with the Mux logo, limited to 10 seconds, deleted after 24 hrs.
When live streaming software disconnects from Mux, either intentionally or due to a drop in the network, the Reconnect Window is the time in seconds that Mux should wait for the streaming software to reconnect before considering the live stream finished and completing the recorded asset. Defaults to 60 seconds on the API if not specified.
Latency is the time from when the streamer does something in real life to when you see it happen in the player. Set this if you want lower latency for your live stream. Note: Reconnect windows are incompatible with Reduced Latency and will always be set to zero (0) seconds. Read more here: https://mux.com/blog/reduced-latency-for-mux-live-streaming-now-available/
Marks the live stream as a test live stream when the value is set to true. A test live stream can help evaluate the Mux Video APIs without incurring any cost. There is no limit on number of test live streams created. Test live streams are watermarked with the Mux logo and limited to 5 minutes. The test live stream is disabled after the stream is active for 5 mins and the recorded asset also deleted after 24 hours.
Arbitrary metadata set by you when creating a simulcast target.
Stream Key represents a stream identifier on the third party live streaming service to send the parent live stream to.
RTMP hostname including application name for the third party live streaming service. Example: 'rtmp://live.example.com/app'.
{
"playback_policy": "public",
"new_asset_settings": {
"playback_policy": "public"
}
}
{
"data": {
"stream_key": "abcdefgh",
"status": "idle",
"reconnect_window": 60,
"playback_ids": [
{
"policy": "public",
"id": "HNRDuwff3K2VjTZZAPuvd2Kx6D01XUQFv02GFBHPUka018"
}
],
"new_asset_settings": {
"playback_policies": [
"public"
]
},
"id": "ZEBrNTpHC02iUah025KM3te6ylM7W4S4silsrFtUkn3Ag",
"created_at": "1609937654"
}
}
List live streamsget
curl https://api.mux.com/video/v1/live-streams \
-X GET \
-H "Content-Type: application/json" \
-u ${MUX_TOKEN_ID}:${MUX_TOKEN_SECRET}
Request path & query params
Number of items to include in the response
Offset by this many pages, of the size of limit
{
"data": [
{
"stream_key": "831b5bde-cd8a-5bc4-115d-4ba34b19f481",
"status": "idle",
"reconnect_window": 60,
"playback_ids": [
{
"policy": "public",
"id": "HNRDuwff3K2VjTZZAPuvd2Kx6D01XUQFv02GFBHPUka018"
}
],
"new_asset_settings": {
"playback_policies": [
"public"
]
},
"id": "ZEBrNTpHC02iUah025KM3te6ylM7W4S4silsrFtUkn3Ag",
"created_at": "1609937654"
},
{
"stream_key": "d273c65e-1fc8-27dc-e9ef-56144cbceb3a",
"status": "idle",
"reconnect_window": 60,
"recent_asset_ids": [
"SZs02xxHgYdkHp00OSCjJiHUHqzVQZNU332XPXRxe341o",
"e4J9cwb5tjVxMeeV8201dC00i800ThPKKGT2SEN002dHH2s"
],
"playback_ids": [
{
"policy": "public",
"id": "00zOcribkUmXqXHzBTpflk2771BRTcKATqPjWf7JHpuM"
}
],
"new_asset_settings": {
"playback_policies": [
"public"
]
},
"id": "B65hEUWW01ErVKDDGImKcBquYhwEAkjW6Ic3lPY0299Cc",
"created_at": "1607587513"
}
]
}
Retrieve a live streamget
Retrieves the details of a live stream that has previously been created. Supply the unique live stream ID that was returned from your previous request, and Mux will return the corresponding live stream information. The same information is returned when creating a live stream.
curl https://api.mux.com/video/v1/live-streams/${LIVE_STREAM_ID} \
-X GET \
-H "Content-Type: application/json" \
-u ${MUX_TOKEN_ID}:${MUX_TOKEN_SECRET}
Request path & query params
The live stream ID
{
"data": {
"stream_key": "831b5bde-cd8a-5bc4-115d-4ba34b19f481",
"status": "idle",
"reconnect_window": 60,
"playback_ids": [
{
"policy": "public",
"id": "HNRDuwff3K2VjTZZAPuvd2Kx6D01XUQFv02GFBHPUka018"
}
],
"new_asset_settings": {
"playback_policies": [
"public"
]
},
"id": "ZEBrNTpHC02iUah025KM3te6ylM7W4S4silsrFtUkn3Ag",
"created_at": "1609937654"
}
}
Delete a live streamdel
curl https://api.mux.com/video/v1/live-streams/${LIVE_STREAM_ID} \
-X DELETE \
-H "Content-Type: application/json" \
-u ${MUX_TOKEN_ID}:${MUX_TOKEN_SECRET}
Request path & query params
The live stream ID
Create a live stream playback IDpost
curl https://api.mux.com/video/v1/live-streams/${LIVE_STREAM_ID}/playback-ids \
-X POST \
-d '{ "policy": "public" }' \
-H "Content-Type: application/json" \
-u ${MUX_TOKEN_ID}:${MUX_TOKEN_SECRET}
Request body params
-
public
playback IDs are accessible by constructing an HLS url likehttps://stream.mux.com/${PLAYBACK_ID}
-
signed
playback IDS should be used with tokenshttps://stream.mux.com/${PLAYBACK_ID}?token={TOKEN}
. See Secure video playback for details about creating tokens.
Request path & query params
The live stream ID
{
"policy": "signed"
}
{
"data": {
"policy": "public",
"id": "4O902oOPU100s7XIQgOeY01U7dHzYlBe26zi3Sq01EJqnxw"
}
}
Delete a live stream playback IDdel
curl https://api.mux.com/video/v1/live-streams/${LIVE_STREAM_ID}/playback-ids/${PLAYBACK_ID} \
-X DELETE \
-H "Content-Type: application/json" \
-u ${MUX_TOKEN_ID}:${MUX_TOKEN_SECRET}
Request path & query params
The live stream ID
The live stream's playback ID.
Reset a live stream’s stream keypost
Reset a live stream key if you want to immediately stop the current stream key from working and create a new stream key that can be used for future broadcasts.
curl https://api.mux.com/video/v1/live-streams/${LIVE_STREAM_ID}/reset-stream-key \
-X POST \
-H "Content-Type: application/json" \
-u ${MUX_TOKEN_ID}:${MUX_TOKEN_SECRET}
Request path & query params
The live stream ID
{
"data": {
"stream_key": "acaf2ca1-ba9c-5ffe-8c9c-a02bbf0009a6",
"status": "idle",
"reconnect_window": 60,
"playback_ids": [
{
"policy": "public",
"id": "HNRDuwff3K2VjTZZAPuvd2Kx6D01XUQFv02GFBHPUka018"
},
{
"policy": "public",
"id": "4O902oOPU100s7XIQgOeY01U7dHzYlBe26zi3Sq01EJqnxw"
}
],
"new_asset_settings": {
"playback_policies": [
"public"
]
},
"id": "ZEBrNTpHC02iUah025KM3te6ylM7W4S4silsrFtUkn3Ag",
"created_at": "1609937654"
}
}
Signal a live stream is finishedput
(Optional) End the live stream recording immediately instead of waiting for the reconnect_window. EXT-X-ENDLIST
tag is added to the HLS manifest which notifies the player that this live stream is over.
Mux does not close the encoder connection immediately. Encoders are often configured to re-establish connections immediately which would result in a new recorded asset. For this reason, Mux waits for 60s before closing the connection with the encoder. This 60s timeframe is meant to give encoder operators a chance to disconnect from their end.
curl https://api.mux.com/video/v1/live-streams/${LIVE_STREAM_ID}/complete \
-X PUT \
-H "Content-Type: application/json" \
-u ${MUX_TOKEN_ID}:${MUX_TOKEN_SECRET}
Request path & query params
The live stream ID
{
"data": {}
}
Disable a live streamput
Disables a live stream, making it reject incoming RTMP streams until re-enabled. The API also ends the live stream recording immediately when active. Ending the live stream recording adds the EXT-X-ENDLIST
tag to the HLS manifest which notifies the player that this live stream is over.
Mux also closes the encoder connection immediately. Any attempt from the encoder to re-establish connection will fail till the live stream is re-enabled.
curl https://api.mux.com/video/v1/live-streams/${LIVE_STREAM_ID}/disable \
-X PUT \
-H "Content-Type: application/json" \
-u ${MUX_TOKEN_ID}:${MUX_TOKEN_SECRET}
Request path & query params
The live stream ID
{
"data": {}
}
Enable a live streamput
Enables a live stream, allowing it to accept an incoming RTMP stream.
curl https://api.mux.com/video/v1/live-streams/${LIVE_STREAM_ID}/enable \
-X PUT \
-H "Content-Type: application/json" \
-u ${MUX_TOKEN_ID}:${MUX_TOKEN_SECRET}
Request path & query params
The live stream ID
{
"data": {}
}
Create a live stream simulcast targetpost
Create a simulcast target for the parent live stream. Simulcast target can only be created when the parent live stream is in idle state. Only one simulcast target can be created at a time with this API.
curl https://api.mux.com/video/v1/live-streams/${LIVE_STREAM_ID}/simulcast-targets \
-X POST \
-d '{"url": "rtmp://live.example.com/app", "stream_key": "abcdefgh", "passthrough":"Example"}' \
-H "Content-Type: application/json" \
-u ${MUX_TOKEN_ID}:${MUX_TOKEN_SECRET}
Request body params
Arbitrary metadata set by you when creating a simulcast target.
Stream Key represents a stream identifier on the third party live streaming service to send the parent live stream to.
RTMP hostname including application name for the third party live streaming service. Example: 'rtmp://live.example.com/app'.
Request path & query params
The live stream ID
{
"url": "rtmp://live.example.com/app",
"stream_key": "abcdefgh",
"passthrough": "Example"
}
{
"data": {
"url": "rtmp://live.example.com/app",
"stream_key": "abcdefgh",
"status": "idle",
"passthrough": "Example",
"id": "le1axfGDc9ETqh6trHNTxGQ9XEhj02fOnX0200aAh24fwlmwzqKCYNJgw"
}
}
Delete a Live Stream Simulcast Targetdel
Delete the simulcast target using the simulcast target ID returned when creating the simulcast target. Simulcast Target can only be deleted when the parent live stream is in idle state.
curl https://api.mux.com/video/v1/live-streams/${LIVE_STREAM_ID}/simulcast-targets/${SIMULCAST_TARGET_ID} \
-X DELETE \
-H "Content-Type: application/json" \
-u ${MUX_TOKEN_ID}:${MUX_TOKEN_SECRET}
Request path & query params
The live stream ID
The ID of the simulcast target.
Retrieve a Live Stream Simulcast Targetget
Retrieves the details of the simulcast target created for the parent live stream. Supply the unique live stream ID and simulcast target ID that was returned in the response of create simulcast target request, and Mux will return the corresponding information.
curl https://api.mux.com/video/v1/live-streams/${LIVE_STREAM_ID}/simulcast-targets/${SIMULCAST_TARGET_ID} \
-X GET \
-H "Content-Type: application/json" \
-u ${MUX_TOKEN_ID}:${MUX_TOKEN_SECRET}
Request path & query params
The live stream ID
The ID of the simulcast target.
{
"data": {
"url": "rtmp://live.example.com/app",
"stream_key": "abcdefgh",
"status": "idle",
"passthrough": "Example",
"id": "02FU00rPq00fC9S6kygrqlxygGMdpW1lk00BkFpCfc2kGregEIr7brt7CQ"
}
}
Playback ID
Properties
Unique identifier for the PlaybackID
-
public
playback IDs are accessible by constructing an HLS url likehttps://stream.mux.com/${PLAYBACK_ID}
-
signed
playback IDS should be used with tokenshttps://stream.mux.com/${PLAYBACK_ID}?token={TOKEN}
. See Secure video playback for details about creating tokens.
Retrieve an Asset or Live Stream IDget
Retrieves the Identifier of the Asset or Live Stream associated with the Playback ID.
Request path & query params
The live stream's playback ID.
{
"data": {
"id": "a1B2c3D4e5F6g7H8i9",
"policy": "public",
"object": {
"type": "asset",
"id": "123456789012345678"
}
}
}
URL Signing Keys
A URL signing key is used as the secret when signing any Mux URL. Mux requires a JSON Web Token as the value of the token query parameter. The token query parameter must be set for URLs that reference a playback ID with a signed playback policy.
Properties
Unique identifier for the Signing Key.
Time at which the object was created. Measured in seconds since the Unix epoch.
A Base64 encoded private key that can be used with the RS256 algorithm when creating a JWT. Note that this value is only returned once when creating a URL signing key.
Create a URL signing keypost
Creates a new signing key pair. When creating a new signing key, the API will generate a 2048-bit RSA key-pair and return the private key and a generated key-id; the public key will be stored at Mux to validate signed tokens.
curl https://api.mux.com/video/v1/signing-keys \
-X POST \
-H "Content-Type: application/json" \
-u ${MUX_TOKEN_ID}:${MUX_TOKEN_SECRET}
{
"data": {
"private_key": "abcd123=",
"id": "vI5KTQ78ohYriuvWKHY6COtZWXexHGLllxksOdZuya8",
"created_at": "1610108345"
}
}
List URL signing keysget
Returns a list of URL signing keys.
curl https://api.mux.com/video/v1/signing-keys \
-X GET \
-H "Content-Type: application/json" \
-u ${MUX_TOKEN_ID}:${MUX_TOKEN_SECRET}
Request path & query params
Number of items to include in the response
Offset by this many pages, of the size of limit
{
"data": [
{
"id": "vI5KTQ78ohYriuvWKHY6COtZWXexHGLllxksOdZuya8",
"created_at": "1610108345"
},
{
"id": "jc6lJiCLMjyC202EXtRQ644sShzDv6x5tWJrbvUFpvmo",
"created_at": "1608632647"
}
]
}
Retrieve a URL signing keyget
Retrieves the details of a URL signing key that has previously been created. Supply the unique signing key ID that was returned from your previous request, and Mux will return the corresponding signing key information. The private key is not returned in this response.
curl https://api.mux.com/video/v1/signing-keys/${SIGNING_KEY_ID} \
-X GET \
-H "Content-Type: application/json" \
-u ${MUX_TOKEN_ID}:${MUX_TOKEN_SECRET}
Request path & query params
The ID of the signing key.
{
"data": {
"id": "jc6lJiCLMjyC202EXtRQ644sShzDv6x5tWJrbvUFpvmo",
"created_at": "1608632647"
}
}
Delete a URL signing keydel
Deletes an existing signing key. Use with caution, as this will invalidate any existing signatures and no URLs can be signed using the key again.
url https://api.mux.com/video/v1/signing-keys/${SIGNING_KEY_ID} \
-X DELETE \
-H "Content-Type: application/json" \
-u ${MUX_TOKEN_ID}:${MUX_TOKEN_SECRET}
Request path & query params
The ID of the signing key.
Direct Uploads
Properties
Unique identifier for the Direct Upload.
Max time in seconds for the signed upload URL to be valid. If a successful upload has not occurred before the timeout limit, the direct upload is marked timed_out
The settings to be used when creating a new asset. You can use any of the usual settings when creating an asset normally, with the exception to not include file url for creating the asset in input. You could optionally add overlay_setting and input urls to add Subtitles / Captions.
Only set once the upload is in the asset_created
state.
Only set if an error occurred during asset creation.
Label for the specific error
Human readable error message
If the upload URL will be used in a browser, you must specify the origin in order for the signed URL to have the correct CORS headers.
The URL to upload the associated source media to.
Indicates if this is a test Direct Upload, in which case the Asset that gets created will be a test
Asset.
Create a new direct upload URLpost
curl https://api.mux.com/video/v1/uploads \
-X POST \
-d '{ "cors_origin": "*", "new_asset_settings": { "playback_policy": ["public"] } }' \
-H "Content-Type: application/json" \
-u ${MUX_TOKEN_ID}:${MUX_TOKEN_SECRET}
Request body params
Max time in seconds for the signed upload URL to be valid. If a successful upload has not occurred before the timeout limit, the direct upload is marked timed_out
If the upload URL will be used in a browser, you must specify the origin in order for the signed URL to have the correct CORS headers.
An array of objects that each describe an input file to be used to create the asset. As a shortcut, input can also be a string URL for a file when only one input file is used. See input[].url
for requirements.
The web address of the file that Mux should download and use.
- For subtitles text tracks, the url is the location of subtitle/captions file. Mux supports SubRip Text (SRT) and Web Video Text Tracks format for ingesting Subtitles and Closed Captions.
- For Watermarking or Overlay, the url is the location of the watermark image.
- When creating clips from existing Mux assets, the url is defined with
mux://assets/{asset_id}
template whereasset_id
is the Asset Identifier for creating the clip from.
An object that describes how the image file referenced in url should be placed over the video (i.e. watermarking).
Where the vertical positioning of the overlay/watermark should begin from. Defaults to "top"
The distance from the vertical_align starting point and the image's closest edge. Can be expressed as a percent ("10%") or as a pixel value ("100px"). Negative values will move the overlay offscreen. In the case of 'middle', a positive value will shift the overlay towards the bottom and and a negative value will shift it towards the top.
Where the horizontal positioning of the overlay/watermark should begin from.
The distance from the horizontal_align starting point and the image's closest edge. Can be expressed as a percent ("10%") or as a pixel value ("100px"). Negative values will move the overlay offscreen. In the case of 'center', a positive value will shift the image towards the right and and a negative value will shift it towards the left.
How wide the overlay should appear. Can be expressed as a percent ("10%") or as a pixel value ("100px"). If both width and height are left blank the width will be the true pixels of the image, applied as if the video has been scaled to fit a 1920x1080 frame. If height is supplied with no width, the width will scale proportionally to the height.
How tall the overlay should appear. Can be expressed as a percent ("10%") or as a pixel value ("100px"). If both width and height are left blank the height will be the true pixels of the image, applied as if the video has been scaled to fit a 1920x1080 frame. If width is supplied with no height, the height will scale proportionally to the width.
How opaque the overlay should appear, expressed as a percent. (Default 100%)
The time offset in seconds from the beginning of the video indicating the clip's starting marker. The default value is 0 when not included. This parameter is only applicable for creating clips when input.url
has mux://assets/{asset_id}
format.
The time offset in seconds from the beginning of the video, indicating the clip's ending marker. The default value is the duration of the video when not included. This parameter is only applicable for creating clips when input.url
has mux://assets/{asset_id}
format.
This parameter is required for the text
track type.
Type of text track. This parameter only supports subtitles value. For more information on Subtitles / Closed Captions, see this blog post. This parameter is required for text
track type.
The language code value must be a valid BCP 47 specification compliant value. For example, en for English or en-US for the US version of English. This parameter is required for text type and subtitles text type track.
The name of the track containing a human-readable description. This value must be unique across all text type and subtitles text
type tracks. The hls manifest will associate a subtitle text track with this value. For example, the value should be "English" for subtitles text track with language_code as en. This optional parameter should be used only for text
type and subtitles text
type track. If this parameter is not included, Mux will auto-populate based on the input[].language_code
value.
Indicates the track provides Subtitles for the Deaf or Hard-of-hearing (SDH). This optional parameter should be used for text
type and subtitles text
type tracks.
This optional parameter should be used for text
type and subtitles text
type tracks.
An array of playback policy names that you want applied to this asset and available through playback_ids
. Options include: "public"
(anyone with the playback URL can stream the asset). And "signed"
(an additional access token is required to play the asset). If no playback_policy is set, the asset will have no playback IDs and will therefore not be playable. For simplicity, a single string name can be used in place of the array in the case of only one playback policy.
-
public
playback IDs are accessible by constructing an HLS url likehttps://stream.mux.com/${PLAYBACK_ID}
-
signed
playback IDS should be used with tokenshttps://stream.mux.com/${PLAYBACK_ID}?token={TOKEN}
. See Secure video playback for details about creating tokens.
Arbitrary metadata that will be included in the asset details and related webhooks. Can be used to store your own ID for a video along with the asset. Max: 255 characters.
Specify what level (if any) of support for mp4 playback. In most cases you should use our default HLS-based streaming playback ({playback_id}.m3u8) which can automatically adjust to viewers' connection speeds, but an mp4 can be useful for some legacy devices or downloading for offline playback. See the Download your videos guide for more information.
Normalize the audio track loudness level. This parameter is only applicable to on-demand (not live) assets.
Specify what level (if any) of support for master access. Master access can be enabled temporarily for your asset to be downloaded. See the Download your videos guide for more information.
Marks the asset as a test asset when the value is set to true. A Test asset can help evaluate the Mux Video APIs without incurring any cost. There is no limit on number of test assets created. Test asset are watermarked with the Mux logo, limited to 10 seconds, deleted after 24 hrs.
{
"cors_origin": "https://example.com/",
"new_asset_settings": {
"playback_policy": [
"public"
],
"mp4_support": "standard"
}
}
[
{
"url": "https://storage.googleapis.com/video-storage-us-east1-uploads/zd01Pe2bNpYhxbrwYABgFE01twZdtv4M00kts2i02GhbGjc?Expires=1610112458&GoogleAccessId=mux-direct-upload%40mux-cloud.iam.gserviceaccount.com&Signature=LCu4PMoKUo%2BJkWQAUwB9WU4bWVVfW3K5bZxSxEptBz3DrjbFxNyGvs0sriyJupZh9Jdb6FxKWFIRbxEetfnAAiesOvSPH%2F1GlIichmGg3YfebfxiX77%2B6ToFF6FMkJucBo284PD90AVLHhKagOea2VsbdO0fh78MAxGH9sEspyQ2uJEfYWjHFqYQ9smJyIuM3CYOmN5HKPgRWy2yUqzV7OTMe%2FivPO4%2FX6XiiN2J4nTmy83252CJUsHIvbiGctfKxcNI6b23UVN4B1tJTVgyxTOZiBQCkMLkD%2FEe5OhoAkvJgkqENRr0q3swO0IChDDWjrh7OTMwqvWGwAoVXEGiHg%3D%3D&upload_id=ABg5-UznTdib1HhOAMjdHhWIYqBbwmSYM6dVKyPe3v33uTeEE8gkN5QzvR3cei6uSZOSrjPn7bdvvDH3nhsrLBq8AjWY2qE4UQ",
"timeout": 3600,
"status": "waiting",
"new_asset_settings": {
"playback_policies": [
"public"
],
"mp4_support": "standard"
},
"id": "zd01Pe2bNpYhxbrwYABgFE01twZdtv4M00kts2i02GhbGjc",
"cors_origin": "https://example.com/"
}
]
List direct uploadsget
curl https://api.mux.com/video/v1/uploads \
-X GET \
-H "Content-Type: application/json" \
-u ${MUX_TOKEN_ID}:${MUX_TOKEN_SECRET}
Request path & query params
Number of items to include in the response
Offset by this many pages, of the size of limit
{
"data": [
{
"url": "https://storage.googleapis.com/video-storage-us-east1-uploads/zd01Pe2bNpYhxbrwYABgFE01twZdtv4M00kts2i02GhbGjc?Expires=1610112458&GoogleAccessId=mux-direct-upload%40mux-cloud.iam.gserviceaccount.com&Signature=LCu4PMoKUo%2BJkWQAUwB9WU4bWVVfW3K5bZxSxEptBz3DrjbFxNyGvs0sriyJupZh9Jdb6FxKWFIRbxEetfnAAiesOvSPH%2F1GlIichmGg3YfebfxiX77%2B6ToFF6FMkJucBo284PD90AVLHhKagOea2VsbdO0fh78MAxGH9sEspyQ2uJEfYWjHFqYQ9smJyIuM3CYOmN5HKPgRWy2yUqzV7OTMe%2FivPO4%2FX6XiiN2J4nTmy83252CJUsHIvbiGctfKxcNI6b23UVN4B1tJTVgyxTOZiBQCkMLkD%2FEe5OhoAkvJgkqENRr0q3swO0IChDDWjrh7OTMwqvWGwAoVXEGiHg%3D%3D&upload_id=ABg5-UznTdib1HhOAMjdHhWIYqBbwmSYM6dVKyPe3v33uTeEE8gkN5QzvR3cei6uSZOSrjPn7bdvvDH3nhsrLBq8AjWY2qE4UQ",
"timeout": 3600,
"status": "waiting",
"new_asset_settings": {
"playback_policies": [
"public"
],
"mp4_support": "standard"
},
"id": "zd01Pe2bNpYhxbrwYABgFE01twZdtv4M00kts2i02GhbGjc",
"cors_origin": "https://example.com/"
},
{
"timeout": 3600,
"status": "asset_created",
"new_asset_settings": {
"playback_policies": [
"public"
],
"mp4_support": "standard"
},
"id": "YzoCL01HHOtAVYq4Ds9zekdHJ2XqL9e8ukPWbr01KhtvM",
"asset_id": "AnFVqAVXfb7vVL3ypSQDMnJZunnb8nkwe02O00p2gK8P00"
},
{
"timeout": 10800,
"status": "cancelled",
"new_asset_settings": {
"playback_policies": [
"public"
],
"mp4_support": "standard"
},
"id": "AZcWu0201SqVW01LMdmVxE00m3gEWUFZPItvni1sTqF800dQ"
}
]
}
Retrieve a single direct upload's infoget
curl https://api.mux.com/video/v1/uploads/${UPLOAD_ID} \
-X GET \
-H "Content-Type: application/json" \
-u ${MUX_TOKEN_ID}:${MUX_TOKEN_SECRET}
Request path & query params
ID of the Upload
{
"data": {
"timeout": 3600,
"status": "asset_created",
"new_asset_settings": {
"playback_policies": [
"public"
],
"mp4_support": "standard"
},
"id": "YzoCL01HHOtAVYq4Ds9zekdHJ2XqL9e8ukPWbr01KhtvM",
"asset_id": "AnFVqAVXfb7vVL3ypSQDMnJZunnb8nkwe02O00p2gK8P00"
}
}
Cancel a direct uploadput
Cancels a direct upload and marks it as cancelled. If a pending upload finishes after this
request, no asset will be created. This request will only succeed if the upload is still in
the waiting
state.
curl https://api.mux.com/video/v1/uploads/${UPLOAD_ID}/cancel \
-X PUT \
-H "Content-Type: application/json" \
-u ${MUX_TOKEN_ID}:${MUX_TOKEN_SECRET}
Request path & query params
ID of the Upload
{
"data": {
"timeout": 3600,
"status": "cancelled",
"new_asset_settings": {
"playback_policies": [
"public"
],
"mp4_support": "standard"
},
"id": "zd01Pe2bNpYhxbrwYABgFE01twZdtv4M00kts2i02GhbGjc",
"cors_origin": "https://example.com/"
}
}
Delivery Usage
The Delivery Usage API allows you to get delivery/streaming usage details for each asset and across all assets. Delivery usage details are aggregated every hour at the top of the hour and can be requested for a specified time window within the last 90 days starting at 12 hours prior to when the request is made.
Assets are ordered by delivery usage starting with the one with the highest usage. Only assets with delivery usage greater than 0 seconds are returned in the response.
Properties
Unique identifier for the live stream that created the asset.
Unique identifier for the asset.
The passthrough
value for the asset.
Time at which the asset was created. Measured in seconds since the Unix epoch.
The state of the asset.
The duration of the asset in seconds.
Total number of delivered seconds during this time window.
List Usageget
Returns a list of delivery usage records and their associated Asset IDs or Live Stream IDs.
curl 'https://api.mux.com/video/v1/delivery-usage?timeframe[]=${START_TIME}&timeframe[]=${END_TIME}' -X GET \
-H "Content-Type: application/json" \
-u ${MUX_TOKEN_ID}:${MUX_TOKEN_SECRET}
Request path & query params
Offset by this many pages, of the size of limit
Number of items to include in the response
Filter response to return delivery usage for this asset only.
Time window to get delivery usage information. timeframe[0] indicates the start time, timeframe[1] indicates the end time in seconds since the Unix epoch. Default time window is 1 hour representing usage from 13th to 12th hour from when the request is made.
{
"total_row_count": 2,
"timeframe": [
1607817600,
1607990400
],
"page": 1,
"limit": 100,
"data": [
{
"live_stream_id": "B65hEUWW01ErVKDDGImKcBquYhwEAkjW6Ic3lPY0299Cc",
"delivered_seconds": 206.366667,
"deleted_at": "1607945257",
"created_at": "1607939184",
"asset_state": "deleted",
"asset_id": "Ww4v2q2H4MNbHIAM2wApKb3cmrh7eHjGLUjdKohR5wM",
"asset_duration": 154.366667
},
{
"delivered_seconds": 30,
"deleted_at": "1607935288",
"created_at": "1607617107",
"asset_state": "deleted",
"asset_id": "Qlb007on1TwN43XLIG027QJlUxm3jd01v5PRi1aXhnyFZY",
"asset_duration": 98.773667
}
]
}
Web Inputs
Web Inputs are Mux-managed web browsers that you can use to broadcast visually compelling live streams from any web page you build.
Properties
Unique identifier for the Web Input.
Time the Web Input was created, defined as a Unix timestamp (seconds since epoch).
The URL for the Web Input to load.
When set to true
the Web Input will automatically launch and start streaming immediately after creation.
The Live Stream ID to broadcast this Web Input to.
Arbitrary metadata that will be included in the Web Input details and related webhooks. Can be used to store your own ID for the Web Input. Max: 255 characters.
The resolution of the viewport of the Web Inputs browser instance. Defaults to 1920x1080 if not set.
The Number of seconds that the Web Input should stream for before automatically shutting down. Defaults to 3600 if not set.
Create a new Web Inputpost
Request body params
The URL for the Web Input to load.
The Live Stream ID to broadcast this Web Input to.
When set to true
the Web Input will automatically launch and start streaming immediately after creation.
Arbitrary metadata that will be included in the Web Input details and related webhooks. Can be used to store your own ID for the Web Input. Max: 255 characters.
The resolution of the viewport of the Web Inputs browser instance. Defaults to 1920x1080 if not set.
The Number of seconds that the Web Input should stream for before automatically shutting down. Defaults to 3600 if not set.
{
"url": "https://example.com/hello.html",
"live_stream_id": "ZEBrNTpHC02iUah025KM3te6ylM7W4S4silsrFtUkn3Ag"
}
{
"data": {
"id": "S3Jlx7KABs1EfhscCGEM02G5RYpgwb02nn",
"created_at": 1609868768,
"url": "https://example.com/hello.html",
"live_stream_id": "ZEBrNTpHC02iUah025KM3te6ylM7W4S4silsrFtUkn3Ag",
"status": "idle",
"resolution": "1920x1080",
"timeout": 3600
}
}
List Web Inputsget
Request path & query params
Number of items to include in the response
Offset by this many pages, of the size of limit
{
"data": [
{
"id": "S3Jlx7KABs1EfhscCGEM02G5RYpgwb02nn",
"created_at": 1609868101,
"url": "https://example.com/hello.html",
"live_stream_id": "ZEBrNTpHC02iUah025KM3te6ylM7W4S4silsrFtUkn3Ag",
"status": "streaming",
"resolution": "1920x1080",
"timeout": 3600
},
{
"id": "eMSK5cBGHTz3DLVjGy02BnrKvCLPN2QdF",
"created_at": 1609868768,
"url": "https://example.com/hello-there.html",
"live_stream_id": "RlWPQAZ1PdGuL2eZYmZ50202XUlc7Cn1AM",
"status": "idle",
"resolution": "720x720",
"timeout": 3600
}
]
}
Retrieve a single Web Input's infoget
Request path & query params
ID of the Web Input
{
"data": {
"id": "S3Jlx7KABs1EfhscCGEM02G5RYpgwb02nn",
"created_at": 1609868768,
"url": "https://example.com/hello.html",
"live_stream_id": "ZEBrNTpHC02iUah025KM3te6ylM7W4S4silsrFtUkn3Ag",
"status": "idle",
"resolution": "1920x1080",
"timeout": 3600
}
}
Delete a Web Inputdel
Deletes a Web Input and all its data
Request path & query params
ID of the Web Input
Launch a Web Inputput
Launches the browser instance and loads the URL specified, then starts streaming to the specified Live Stream.
Request path & query params
ID of the Web Input
{
"data": {}
}
Shutdown a Web Inputput
Ends streaming to the specified Live Stream, then shuts down the Web Input browser instance.
Request path & query params
ID of the Web Input
{
"data": {}
}
Reload a Web Inputput
Reloads the page that a Web Input is displaying. Note: Using this when the Web Input is streaming will display the page reloading.
Request path & query params
ID of the Web Input
{
"data": {}
}
Update Web Input URLput
Changes the URL that a Web Input loads when it launches. Note: Can only be called when the Web Input is idle.
Request body params
The URL for the Web Input to load.
Request path & query params
ID of the Web Input
{
"url": "https://example.com/hello-there.html"
}
{
"data": {
"id": "S3Jlx7KABs1EfhscCGEM02G5RYpgwb02nn",
"created_at": 1609868768,
"url": "https://example.com/hello-there.html",
"live_stream_id": "ZEBrNTpHC02iUah025KM3te6ylM7W4S4silsrFtUkn3Ag",
"status": "idle",
"resolution": "1920x1080",
"timeout": 3600
}
}