# FFmpeg API Waveform

> Get waveform data from audio files using FFmpeg API.


## Overview

- **Endpoint**: `https://fal.run/fal-ai/ffmpeg-api/waveform`
- **Model ID**: `fal-ai/ffmpeg-api/waveform`
- **Category**: json
- **Kind**: inference
**Tags**: ffmpeg



## Pricing

- **Price**: $0 per compute seconds

For more details, see [fal.ai pricing](https://fal.ai/pricing).

## API Information

This model can be used via our HTTP API or more conveniently via our client libraries.
See the input and output schema below, as well as the usage examples.


### Input Schema

The API accepts the following input parameters:


- **`media_url`** (`string`, _required_):
  URL of the audio file to analyze

- **`points_per_second`** (`float`, _optional_):
  Controls how many points are sampled per second of audio. Lower values (e.g. 1-2) create a coarser waveform, higher values (e.g. 4-10) create a more detailed one. Default value: `4`
  - Default: `4`
  - Range: `1` to `10`

- **`precision`** (`integer`, _optional_):
  Number of decimal places for the waveform values. Higher values provide more precision but increase payload size. Default value: `2`
  - Default: `2`
  - Range: `1` to `6`

- **`smoothing_window`** (`integer`, _optional_):
  Size of the smoothing window. Higher values create a smoother waveform. Must be an odd number. Default value: `3`
  - Default: `3`
  - Range: `1` to `21`



**Required Parameters Example**:

```json
{
  "media_url": ""
}
```

**Full Example**:

```json
{
  "media_url": "",
  "points_per_second": 4,
  "precision": 2,
  "smoothing_window": 3
}
```


### Output Schema

The API returns the following output format:

- **`waveform`** (`list<float>`, _required_):
  Normalized waveform data as an array of values between -1 and 1. The number of points is determined by audio duration × points_per_second.
  - Array of float

- **`duration`** (`float`, _required_):
  Duration of the audio in seconds

- **`points`** (`integer`, _required_):
  Number of points in the waveform data

- **`precision`** (`integer`, _required_):
  Number of decimal places used in the waveform values



**Example Response**:

```json
{}
```


## Usage Examples

### cURL

```bash
curl --request POST \
  --url https://fal.run/fal-ai/ffmpeg-api/waveform \
  --header "Authorization: Key $FAL_KEY" \
  --header "Content-Type: application/json" \
  --data '{
     "media_url": ""
   }'
```

### Python

Ensure you have the Python client installed:

```bash
pip install fal-client
```

Then use the API client to make requests:

```python
import fal_client

def on_queue_update(update):
    if isinstance(update, fal_client.InProgress):
        for log in update.logs:
           print(log["message"])

result = fal_client.subscribe(
    "fal-ai/ffmpeg-api/waveform",
    arguments={
        "media_url": ""
    },
    with_logs=True,
    on_queue_update=on_queue_update,
)
print(result)
```

### JavaScript

Ensure you have the JavaScript client installed:

```bash
npm install --save @fal-ai/client
```

Then use the API client to make requests:

```javascript
import { fal } from "@fal-ai/client";

const result = await fal.subscribe("fal-ai/ffmpeg-api/waveform", {
  input: {
    media_url: ""
  },
  logs: true,
  onQueueUpdate: (update) => {
    if (update.status === "IN_PROGRESS") {
      update.logs.map((log) => log.message).forEach(console.log);
    }
  },
});
console.log(result.data);
console.log(result.requestId);
```


## Additional Resources

### Documentation

- [Model Playground](https://fal.ai/models/fal-ai/ffmpeg-api/waveform)
- [API Documentation](https://fal.ai/models/fal-ai/ffmpeg-api/waveform/api)
- [OpenAPI Schema](https://fal.ai/api/openapi/queue/openapi.json?endpoint_id=fal-ai/ffmpeg-api/waveform)

### fal.ai Platform

- [Platform Documentation](https://fal.ai/docs/documentation)
- [Python Client](https://fal.ai/docs/api-reference/client-libraries/python)
- [JavaScript Client](https://fal.ai/docs/api-reference/client-libraries/javascript)

### Other agent-readable surfaces

This file covers one model. To find anything else:

- [Platform overview](https://fal.ai/llms.txt): Entry points and representative endpoint IDs
- [Documentation index](https://fal.ai/docs/llms.txt): Every documentation page
- [Full documentation text](https://fal.ai/docs/llms-full.txt): The whole documentation inlined
- Any other model: `https://fal.ai/models/<endpoint-id>/llms.txt`
