> ## Documentation Index
> Fetch the complete documentation index at: https://docs.chowder.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# read_videos

> Read video files as a SQL table, one row per time window.

`read_videos` divides each video into fixed time windows and returns one row per window. Each row has a representative frame in `image` and the speech from that window in `transcript`.

See [Models](https://docs.chowder.ai/concepts/models.md) for the transcription model. Frame extraction doesn't use a model.

## Signature

```chowder-sql theme={"theme":"css-variables","languages":{"custom":["/languages/chowder-sql.json"]}}
read_videos(pattern [, window_s])
```

| Parameter | Type | Default | Description |
| - | - | - | - |
| `pattern` | `VARCHAR` | — | A video file, directory, glob, or supported remote URI. |
| `window_s` | Positive number literal | `5` | Length of each window, in seconds. |

Supported extensions: `.mp4`, `.mov`, `.mkv`, `.webm`, `.avi`, and `.m4v`.

## Example

```chowder-sql theme={"theme":"css-variables","languages":{"custom":["/languages/chowder-sql.json"]}}
SELECT
    source,
    window_number,
    frame_timestamp_s,
    width,
    height,
    transcript -- Speech segments starting within this window
FROM read_videos('hf://buckets/chowderai/chowder-demo/video/data/steve-jobs-on-passion.mp4')
LIMIT 5;
```

## Columns

| Column | Type | Description |
| - | - | - |
| `source` | `VARCHAR` | Input path or URI. |
| `window_number` | `BIGINT` | One-based window number. |
| `window_count` | `BIGINT` | Total windows in the video, when known. |
| `start_s`, `end_s` | `DOUBLE` | Window boundaries in seconds. |
| `duration_s` | `DOUBLE` | Length of the whole video, in seconds. |
| `frame_timestamp_s` | `DOUBLE` | Time of the representative frame, in seconds. |
| `image_content_id` | `VARCHAR` | Hash of the frame's JPEG bytes. |
| `image` | `BINARY` | Representative frame, as JPEG bytes. |
| `format` | `VARCHAR` | Frame image format, always `jpeg`. |
| `width`, `height` | `INT` | Frame dimensions. |
| `size_bytes` | `BIGINT` | Size of the frame's JPEG bytes. |
| `transcript` | `ARRAY<STRUCT>` | Timestamped speech segments that start in the window. |
| `metadata` | `STRUCT<error VARCHAR>` | `error`: why the frame or transcript failed. Null otherwise. |

Each transcript item contains `start_s`, `end_s`, and `text`.

A null transcript indicates a failure or that transcription was not produced. An empty list means no speech. A frame failure retains the row with empty image bytes, a null `image_content_id`, and an error in `metadata`. Files larger than `CHOWDER_MAX_FILE_MB` (500 MB by default) are skipped with a warning and produce no rows. A remote server can set its own limit. See [Configuration](https://docs.chowder.ai/reference/configuration.md).

## Set the window duration

Pass the window size in seconds as the second argument. For example, use 10-second windows with:

```chowder-sql theme={"theme":"css-variables","languages":{"custom":["/languages/chowder-sql.json"]}}
SELECT
    source,
    window_number,
    start_s,
    end_s
FROM read_videos('hf://buckets/chowderai/chowder-demo/video/data/steve-jobs-on-passion.mp4', 10)
LIMIT 5;
```

## Execution

* Chowder seeks to each window's frame instead of decoding every frame.
* Queries that select only `source`, `duration_s`, and the window columns, including `count(*)`, don't extract frames.
* Transcription runs only when the query selects `transcript`.
* `LIMIT` stops sampling once the query has enough rows.
* Transcription runs locally with whisper.cpp, or on the server with remote compute. Use `LocalTranscriptionConfig` to choose the local model.

See [Caching](https://docs.chowder.ai/concepts/caching.md) for result reuse, cache validity, and cache controls.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.