---
title: "VideoReader"
sidebar_label: "VideoReader"
description: "Kotlin binding reference: VideoReader."
---

<!-- Generated by tools/api_reference/generate_api_docs.py. Do not edit. -->

//[clika-runtime](../../../index.md)/[io.clika.runtime](../index.md)/[VideoReader](index.md)

# VideoReader

[common]\
class [VideoReader](index.md)

A lazily opened video: [open](Companion/open.md) reads the header only, [info](info.md) reports the stream facts, and each read decodes exactly the frames it names. The decode runs through the ffmpeg command the host provides ([Io.videoCapability](../Io/videoCapability.md)). `AutoCloseable`: [close](close.md) releases the reader and its decoder state; a released reader refuses every call.

```kotlin
VideoReader.open("/path/clip.mp4").use { reader ->
    val batch = reader.sampleUniform(8)      // 8 frames across the clip
    batch.frames.use { frames -> /* [8, H, W, 3] UInt8 */}
}
```

## Types

| Name | Summary |
|---|---|
| [Companion](Companion/index.md) | [common]<br>object [Companion](Companion/index.md) |

## Properties

| Name | Summary |
|---|---|
| [info](info.md) | [common]<br>val [info](info.md): [VideoInfo](../VideoInfo/index.md)<br>The stream's static facts, read at open. |

## Functions

| Name | Summary |
|---|---|
| [close](close.md) | [common]<br>open fun [close](close.md)() |
| [frameBytes](frameBytes.md) | [common]<br>fun [frameBytes](frameBytes.md)(index: [Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)): [ByteArray](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html)<br>One frame's raw RGB bytes (`H * W * 3`), row-major. |
| [framesAt](framesAt.md) | [common]<br>fun [framesAt](framesAt.md)(indices: [LongArray](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long-array/index.html)): [FrameBatch](../FrameBatch/index.md)<br>Decode exactly the frames at [indices](framesAt.md), in that order. |
| [framesAtTimestamps](framesAtTimestamps.md) | [common]<br>fun [framesAtTimestamps](framesAtTimestamps.md)(seconds: [DoubleArray](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-double-array/index.html)): [FrameBatch](../FrameBatch/index.md)<br>Decode the frame nearest each timestamp in [seconds](framesAtTimestamps.md). |
| [sampleUniform](sampleUniform.md) | [common]<br>fun [sampleUniform](sampleUniform.md)(count: [Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)): [FrameBatch](../FrameBatch/index.md)<br>Sample [count](sampleUniform.md) frames uniformly across the whole clip. |