Guides · Read video metadata with ffprobe

# Read video metadata with ffprobe

Send the file to ffprobe and list the fields you want. The response is ffprobe’s own JSON, with the file’s name in place of its path.

## The request

Request

```bash
curl https://media.logicboostkit.com/ffprobe/analyze \
  -H "Authorization: Basic $MEDIA_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "file_path": "dir_pi23jgy1yxlmigi873bz/source.mp4",
    "probe": {
      "format": [
        "duration",
        "size",
        "bit_rate",
        "format_name"
      ],
      "streams": [
        "codec_type",
        "codec_name",
        "width",
        "height",
        "r_frame_rate"
      ]
    }
  }'
```

Response

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

{
  "ok": true,
  "result": {
    "programs": [],
    "stream_groups": [],
    "streams": [
      {
        "codec_type": "video",
        "codec_name": "h264",
        "width": 1920,
        "height": 1080,
        "r_frame_rate": "30000/1001"
      },
      {
        "codec_type": "audio",
        "codec_name": "aac"
      }
    ],
    "format": {
      "format_name": "mov,mp4,m4a,3gp,3g2,mj2",
      "duration": "1204.704000",
      "size": "1937244979",
      "bit_rate": "12864481"
    }
  },
  "usage": {
    "time_sec": 0.31,
    "input_size_gb": 1.804199982,
    "output_size_gb": 2.83e-7,
    "gb_sec": 0.559302082
  },
  "request_id": "job_0mv6hnzdy93wuugau1rys4cn",
  "amount_usd": 0.007449904
}
```

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

## The options, explained

What each option does

- `format`: Fields about the file as a whole: duration in seconds, size in bytes, overall bit rate, container.
- `streams`: Fields of each stream: its type, codec, picture size and frame rate.

## Variations

### Every field

Leave `probe` out to get the format and every stream with all their fields.

### Only the video stream

Add select_streams to the probe object.

```
In "probe": "select_streams":"v:0"
```

### A file on the web

Give `file_path` as a public HTTPS URL. The copy is deleted when the request ends.

## What it costs

Probing a 2 GB video: (2 GB + 0 GB) × 0.3 s = 0.600 GB-seconds, which is USD 0.0080 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).
