Guides · Burn subtitles into a video

# Burn subtitles into a video

Upload the subtitle file beside the video, give both as inputs, and apply the `subtitles` filter. Inputs from one directory are in the job’s folder, so the filter finds the file by its name.

## The request

Request

```bash
curl https://media.logicboostkit.com/ffmpeg/process \
  -H "Authorization: Basic $MEDIA_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "task": {
      "inputs": [
        {
          "file_path": "dir_pi23jgy1yxlmigi873bz/source.mp4"
        },
        {
          "file_path": "dir_pi23jgy1yxlmigi873bz/subtitles.srt"
        }
      ],
      "outputs": [
        {
          "file": "subtitled.mp4",
          "maps": [
            "0:v",
            "0:a"
          ],
          "options": [
            "-vf",
            "subtitles=subtitles.srt",
            "-c:v",
            "libx264",
            "-crf",
            "23",
            "-c:a",
            "copy"
          ]
        }
      ]
    }
  }'
```

Response

```http
HTTP/1.1 200 OK
X-Request-Id: job_0mv6iv6v5rmhf80bjaztl3yl

{
  "ok": true,
  "result": [
    {
      "file_name": "subtitled.mp4",
      "size_bytes": 702545920,
      "download_url": "https://…"
    }
  ],
  "usage": {
    "time_sec": 61,
    "input_size_gb": 0.68359375,
    "output_size_gb": 0.654296875,
    "gb_sec": 81.611328125
  },
  "request_id": "job_0mv6iv6v5rmhf80bjaztl3yl",
  "amount_usd": 1.087062891
}
```

The input is a file you uploaded ([POST /file](https://media.logicboostkit.com/docs/post-file)). The full reference is [POST /ffmpeg/process](https://media.logicboostkit.com/docs/post-ffmpeg-process).

## The options, explained

What each option does

- `maps 0:v and 0:a`: The output takes the video and audio of the first input, and not the subtitle file as a stream of its own.
- `subtitles=subtitles.srt`: Draws the subtitles onto the picture. SRT, WebVTT and ASS files work; ASS keeps its own styling.
- `-c:v libx264 -crf 23`: The picture changes, so the video is re-encoded.
- `-c:a copy`: The audio is copied as it is.

## Variations

### Larger text

force_style sets the font size and other styles for SRT and WebVTT files.

```
In the output: "options": ["-vf", "subtitles=subtitles.srt:force_style='FontSize=28'", "-c:v", "libx264", "-crf", "23", "-c:a", "copy"]
```

### Soft subtitles instead

A track the viewer can turn on and off, without re-encoding: map the subtitle input too, as mov_text.

```
In the output: "maps": ["0:v", "0:a", "1:s"], "options": ["-c:v", "copy", "-c:a", "copy", "-c:s", "mov_text"]
```

## What it costs

Subtitles burned into a 0.7 GB, 10-minute video: (0.7 GB + 0.65 GB) × 61 s = 82.350 GB-seconds, which is USD 1.0969 at USD 0.01332 per GB-second.

The seconds are an example; every response reports the job’s own. Failed jobs are not charged. See [Pricing](https://media.logicboostkit.com/pricing).
