# Add auto-generated captions to your videos and use transcripts
Learn how to add auto-generated captions to your on-demand Mux Video assets, to increase accessibility and to create transcripts for further processing.
## How auto-generated captions work

Mux uses [OpenAI's Whisper model](https://openai.com/index/whisper) to automatically generate captions for on-demand assets. This guide shows you how to enable this feature, what you can do with it, and what some of the limitations you might encounter are.

Generally, you should expect auto-generated captions to work well for content with reasonably clear audio. It may work less well with assets that contain a lot of non-speech audio (music, background noise, extended periods of silence).

We recommend that you try it out on some of your typical content, and see if the results meet your expectations.

This feature is designed to generate captions in the same language that your content's audio is produced in. It should not be used to programatically generate translated captions in other languages.

## Enable auto-generated captions

When you <ApiRefLink href="/docs/api-reference/video/assets/create-asset">create a Mux Asset</ApiRefLink>, you can add a `generated_subtitles` array to the API call, as follows:

```json
// POST /video/v1/assets
{
    "inputs": [
        {
            "url": "...",
            "generated_subtitles": [
                {
                    "language_code": "en",
                    "name": "English CC"
                }
            ]
        }
    ],
    "playback_policies": [
      "public"
    ],
    "video_quality": "basic"
}
```

Mux supports the following languages and corresponding language codes for VOD generated captions. Languages labeled as "beta" may have lower accuracy.

| Language | Language Code | Status |
| :-- | :-- | :-- |
| English | en | Stable |
| Spanish | es | Stable |
| Italian | it | Stable |
| Portuguese | pt | Stable |
| German | de | Stable |
| French | fr | Stable |
| Automatic Detection | auto | Stable |
| Polish | pl | Beta |
| Russian | ru | Beta |
| Dutch | nl | Beta |
| Catalan | ca |  Beta |
| Turkish | tr |  Beta |
| Swedish | sv | Beta |
| Ukrainian | uk | Beta |
| Norwegian | no | Beta |
| Finnish | fi | Beta |
| Slovak | sk | Beta |
| Greek | el | Beta |
| Czech | cs | Beta |
| Croatian | hr | Beta |
| Danish | da | Beta |
| Romanian | ro | Beta |
| Bulgarian | bg | Beta |

You can also enable autogenerated captions if you're <ApiRefLink href="/docs/api-reference/video/direct-uploads/create-direct-upload">using Direct Uploads</ApiRefLink> by specifying the `generated_subtitles` configuration in the first entry of the `input` list of the `new_asset_settings` object, like this:

```json
// POST /video/v1/uploads
{
    "new_asset_settings": {
        "playback_policies": [
            "public"
        ],
        "video_quality": "basic",
        "inputs": [
            {
                "generated_subtitles": [
                    {
                        "language_code": "en",
                        "name": "English CC"
                    }
                ]
            }
        ]
    },
    "cors_origin": "*"
}
```

Auto-captioning happens separately from the initial asset ingest, so that this doesn't delay the asset being available for playback. If you want to know when the text track for the captions is ready, listen for the `video.asset.track.ready` webhook for a track with `"text_source": "generated_vod"`.

### Retroactively enable auto-generated captions

You can retroactively add captions to any asset by POSTing to the `generate-subtitles` endpoint on the asset audio track that you want to generate captions for, as shown below:

```json
// POST /video/v1/assets/${ASSET_ID}/tracks/${AUDIO_TRACK_ID}/generate-subtitles

{
  "generated_subtitles": [
    {
      "language_code": "en",
      "name": "English (generated)"
    }
  ]
}
```

**For self-service customers:** You can add captions to any asset using this API.

**For contract customers:** If you need to add captions to assets older than 7 days, [please contact support](/support) and we'd be happy to help. Please note that there may be a charge for backfilling captions onto large libraries.

## Retrieve a transcript

For assets that have a `ready` auto-generated captions track, you can also request a transcript (a plain text file) of the speech recognized in your asset.

To get this, use a playback id for your asset and the track id for the `generated_vod` text track:

<Callout>
  If you don't know the `TRACK_ID`, you can retrieve it by listing the asset's tracks using the{' '}
  <ApiRefLink href="/docs/api-reference/video/assets">Asset endpoint</ApiRefLink> under `tracks` and the corresponding `track.id`.
</Callout>

```
https://stream.mux.com/{PLAYBACK_ID}/text/{TRACK_ID}.txt
```

Signed assets require a `token` parameter specifying a JWT with the same `aud` claim used for [video playback](/docs/guides/secure-video-playback#4-generate-a-json-web-token-jwt):

```
https://stream.mux.com/{PLAYBACK_ID}/text/{TRACK_ID}.txt?token={JWT}
```

You can also retrieve a WebVTT version of the text track by replacing `.txt` with `.vtt` in the URL.

You might find this transcript useful for doing further processing in other systems. For example, content moderation, sentiment analysis, summarization, extracting insights from your content, and many more.

## FAQ

### How much does auto-generated captioning cost for on-demand assets?

There is no additional charge for this feature. It's included as part of the standard encoding and storage charges for Mux Video assets.

### How long does it take to generate captions?

It depends on the length of the asset, but generally it takes about 0.1x content duration. As an example, a 1 hour asset would take about 6 minutes to generate captions for.

### Help, the captions you generated are full of mistakes!

We're sorry to hear that! Unfortunately, though automatic speech recognition has improved enormously in recent years, sometimes it can still get things wrong.

One option you have is to edit and replace the mis-recognized speech in the captions track:

1. Download the full VTT file we generated at `https://stream.mux.com/{PLAYBACK_ID}/text/{TRACK_ID}.vtt`
2. Edit the VTT file using your preferred text editor
3. Delete the autogenerated track with the <ApiRefLink href="/docs/api-reference/video/assets/delete-asset-track">'delete track' API</ApiRefLink>
4. Add a new track to your asset using the edited VTT file, using the <ApiRefLink href="/docs/api-reference/video/assets/create-asset-track">`create track` API</ApiRefLink>

### My content is in multiple languages

We currently do not recommend using this feature on mixed-language content.

### I want to generate captions in a different language to my content

We currently do not support automatic translation in generated captions - you should only generate captions in the language that matches your audio track.

### My content is in a language you don't support

We'd love to hear more about the languages that you'd like to see us support, please [reach out](/support) with details.
