# Extract Audio

**What**：Extract the audio track from a video.

**When**：Use to get audio only (e.g. to mp3).

## 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 |
| format | string | — | Audio format: mp3 / aac / wav, default mp3 |
| 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": "extract_audio",
  "input_url": "https://cdn.novapi.ai/veo31/1788164205419_de868f9d69d445baaf577d42e87a236f.mp4",
  "format": "mp3"
}'
```

```python
import os, requests

r = requests.post(
    "https://api.novapi.ai/v1/ffmpeg/jobs",
    headers={"Authorization": "Bearer " + os.environ["API_KEY"]},
    json={
        "operation": "extract_audio",
        "input_url": "https://cdn.novapi.ai/veo31/1788164205419_de868f9d69d445baaf577d42e87a236f.mp4",
        "format": "mp3",
    },
)
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": "extract_audio",
    "input_url": "https://cdn.novapi.ai/veo31/1788164205419_de868f9d69d445baaf577d42e87a236f.mp4",
    "format": "mp3"
  }),
});
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": "extract_audio",
  "status": "queued",
  "progress": 0,
  "cost": 0
}
```

```json
{
  "id": "<job-id>",
  "object": "ffmpeg.job",
  "operation": "extract_audio",
  "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"
```
