# Burn Subtitle

**What**：Add subtitles to a video: soft = a switchable subtitle track (no re-encode); hard = burned into the pixels (permanent, forces a re-encode).

**When**：Use to caption a video. Pick soft to keep a toggleable track; pick hard to always show captions (e.g. short/vertical clips). Recognizes .srt / .ass / .vtt (others treated as .srt); Chinese hard subtitles use a built-in Noto CJK font, no extra config needed.

## Endpoints
- POST `/v1/ffmpeg/jobs`
- GET `/v1/ffmpeg/jobs/{id}`

> This page uses the unified API: create with `POST /v1/ffmpeg/jobs` (`operation` names the operation), poll with `GET /v1/ffmpeg/jobs/{id}`. File upload still uses `POST /v1/ffmpeg/upload`.

Poll `GET /v1/ffmpeg/jobs/{id}` until `status` is `completed` or `failed`; a failed job is still HTTP 200 with `error`.

## Request params
| Param | Type | Required | Description |
| --- | --- | --- | --- |
| input_url | string | Yes | Input media URL on a trusted allowlist domain (platform CDN or a trusted-source CDN); upload first to obtain one, or use an asset URL already on a trusted CDN |
| subtitle_url | string | Yes | Subtitle file URL (trusted allowlist domain); recognizes .srt / .ass / .vtt, other extensions treated as .srt |
| mode | string | — | Mode: soft (mov_text switchable track, no re-encode, mp4 output) / hard (burned into pixels, video re-encoded, audio copied), default soft |
| webhook_url | string | — | Completion webhook URL (optional) |

Fields other than `operation` are the operation parameters; input slots use snake_case (`input_url`, `input_urls`, `image_url`, `audio_url`, `audio_urls`, `subtitle_url`, `webhook_url`); the old camelCase names are still accepted.

## Request example
```bash
curl https://api.novapi.ai/v1/ffmpeg/jobs \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "operation": "burn_subtitle",
  "input_url": "https://cdn.novapi.ai/veo31/1788164205419_de868f9d69d445baaf577d42e87a236f.mp4",
  "subtitle_url": "https://cdn.novapi.ai/tmp/captions.srt",
  "mode": "soft"
}'
```

```python
import os, requests

r = requests.post(
    "https://api.novapi.ai/v1/ffmpeg/jobs",
    headers={"Authorization": "Bearer " + os.environ["API_KEY"]},
    json={
        "operation": "burn_subtitle",
        "input_url": "https://cdn.novapi.ai/veo31/1788164205419_de868f9d69d445baaf577d42e87a236f.mp4",
        "subtitle_url": "https://cdn.novapi.ai/tmp/captions.srt",
        "mode": "soft",
    },
)
print(r.json())  # poll GET /v1/ffmpeg/jobs/{id} until status is completed
```

```ts
const resp = await fetch("https://api.novapi.ai/v1/ffmpeg/jobs", {
  method: "POST",
  headers: {
    Authorization: "Bearer " + process.env.API_KEY,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "operation": "burn_subtitle",
    "input_url": "https://cdn.novapi.ai/veo31/1788164205419_de868f9d69d445baaf577d42e87a236f.mp4",
    "subtitle_url": "https://cdn.novapi.ai/tmp/captions.srt",
    "mode": "soft"
  }),
});
console.log(await resp.json()); // poll GET /v1/ffmpeg/jobs/{id} until status is completed
```

## Response example
```json
{
  "id": "<job-id>",
  "object": "ffmpeg.job",
  "operation": "burn_subtitle",
  "status": "queued",
  "progress": 0,
  "cost": 0
}
```

```json
{
  "id": "<job-id>",
  "object": "ffmpeg.job",
  "operation": "burn_subtitle",
  "status": "completed",
  "progress": 100,
  "result_url": "https://...",
  "cost": <points>
}
```

```bash
curl https://api.novapi.ai/v1/ffmpeg/jobs/<job-id> \
  -H "Authorization: Bearer $API_KEY"
```
