Learn how to add metadata to your videos for better organization, discoverability, and actionable analytics.
Metadata provides additional descriptive information about your video assets. Mux currently supports three key optional metadata fields that help you organize and manage your video content across the API and dashboard:
title
: A descriptive name for your video content. We limit this to 512 code points.creator_id
: A value you set to identify the creator or owner of the video. We limit this to 128 code points.external_id
: Another value you set to reference this asset in your system, such as the video ID in your database. We limit this to 128 code points.What is a code point? Many of us use the term "characters" when referring to letters in a string, but when storing those characters some cost more than others. This cost is called a "code point".
While each ASCII character can be stored with a single code point, some unicode characters, such as é
, are stored as two code points. One for the e
, and one for the ́
. You can easily test this in JavaScript. JavaScript's .length
property counts code points, not characters, so "é".length
will be 2
.
Here's an example of what a meta
object might look like:
{
"title": "Guide: Adding metadata to videos",
"creator_id": "user_23456",
"external_id": "cdef2345"
}
Note: Do not include personally identifiable information in these fields. They will be accessible by browsers to display player UI.
Once set on an asset, you'll find this metadata on assets across the Mux API and dashboard, including asset management, engagement and data.
We've deeply integrated asset metadata throughout the Mux dashboard:
When creating an asset you can include your metadata in the body of the request.
// POST /video/v1/assets
{
"input": "https://storage.googleapis.com/muxdemofiles/mux.mp4",
"playback_policy": "public",
"video_quality": "basic",
"meta": {
"title": "Mux demo video",
"creator_id": "abcd1234",
"external_id": "bcde2345"
}
}
Once an asset has been created the metadata can be changed at any time. Make a request to update the asset and include your metadata in the request body.
// PATCH /video/v1/assets/{ASSET_ID}
{
"meta": {
"title": "Updated Mux demo video",
"creator_id": "cdef3456",
"external_id": "defg4567"
}
}
Direct uploads are a multi-step process, and metadata should be attached in the very first step. When creating your authenticated URL in that first step you can include your metadata alongside the rest of the asset settings in new_asset_settings
.
// POST /video/v1/uploads
{
"new_asset_settings": {
"playback_policy": "public",
"video_quality": "basic",
"meta": {
"title": "Mux demo video",
"creator_id": "abcd1234",
"external_id": "bcde2345"
}
},
"cors_origin": "*",
}
Mux automatically creates a new asset each time you connect to a live stream. When creating or updating your live stream you can include metadata that gets automatically set on the generated assets in the request body, under new_asset_settings
.
// POST /video/v1/live-streams
{
"playback_policy": "public",
"new_asset_settings": {
"playback_policy": "public",
},
"meta": {
"title": "Mux demo live stream recording",
"creator_id": "abcd1234",
"external_id": "bcde2345"
}
}