Skip to main content

//clika-runtime/io.clika.runtime/VideoReader

VideoReader

[common]
class VideoReader

A lazily opened video: open reads the header only, info 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). AutoCloseable: close releases the reader and its decoder state; a released reader refuses every call.

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​

NameSummary
Companion[common]
object Companion

Properties​

NameSummary
info[common]
val info: VideoInfo
The stream's static facts, read at open.

Functions​

NameSummary
close[common]
open fun close()
frameBytes[common]
fun frameBytes(index: Long): ByteArray
One frame's raw RGB bytes (H * W * 3), row-major.
framesAt[common]
fun framesAt(indices: LongArray): FrameBatch
Decode exactly the frames at indices, in that order.
framesAtTimestamps[common]
fun framesAtTimestamps(seconds: DoubleArray): FrameBatch
Decode the frame nearest each timestamp in seconds.
sampleUniform[common]
fun sampleUniform(count: Long): FrameBatch
Sample count frames uniformly across the whole clip.