ofVideo

expect fun ofVideo(bytes: ByteArray, width: Int, height: Int, pixelFormat: PixelFormat, ptsMicros: Long = FrameInfo.NOPTS): Frame

Build a video frame from raw pixel bytes. This is the entry point for generative use: images-to-video, procedural frames, and pixels produced by other libraries.

bytes must be tightly packed planes in pixelFormat's layout. That is exactly what copyPlanesToByteArray produces (yuv420p: Y then U then V, no padding; rgba: interleaved). Size must be at least the format's buffer size for widthxheight.

The frame owns its buffers (close it or hand it to an encoder/filter, which closes it for you). ptsMicros sets the timestamp on a 1/1_000_000 time-base; FrameInfo.NOPTS leaves it unset (encoders then fall back to a frame counter).

Throws

on unknown pixel format, allocation failure, or short bytes

actual fun ofVideo(bytes: ByteArray, width: Int, height: Int, pixelFormat: PixelFormat, ptsMicros: Long): Frame

Build a video frame from raw pixel bytes. This is the entry point for generative use: images-to-video, procedural frames, and pixels produced by other libraries.

bytes must be tightly packed planes in pixelFormat's layout. That is exactly what copyPlanesToByteArray produces (yuv420p: Y then U then V, no padding; rgba: interleaved). Size must be at least the format's buffer size for widthxheight.

The frame owns its buffers (close it or hand it to an encoder/filter, which closes it for you). ptsMicros sets the timestamp on a 1/1_000_000 time-base; FrameInfo.NOPTS leaves it unset (encoders then fall back to a frame counter).

Throws

on unknown pixel format, allocation failure, or short bytes

actual fun ofVideo(bytes: ByteArray, width: Int, height: Int, pixelFormat: PixelFormat, ptsMicros: Long): Frame

Build a video frame from raw pixel bytes. This is the entry point for generative use: images-to-video, procedural frames, and pixels produced by other libraries.

bytes must be tightly packed planes in pixelFormat's layout. That is exactly what copyPlanesToByteArray produces (yuv420p: Y then U then V, no padding; rgba: interleaved). Size must be at least the format's buffer size for widthxheight.

The frame owns its buffers (close it or hand it to an encoder/filter, which closes it for you). ptsMicros sets the timestamp on a 1/1_000_000 time-base; FrameInfo.NOPTS leaves it unset (encoders then fall back to a frame counter).

Throws

on unknown pixel format, allocation failure, or short bytes

actual fun ofVideo(bytes: ByteArray, width: Int, height: Int, pixelFormat: PixelFormat, ptsMicros: Long): Frame

Build a video frame from raw pixel bytes. This is the entry point for generative use: images-to-video, procedural frames, and pixels produced by other libraries.

bytes must be tightly packed planes in pixelFormat's layout. That is exactly what copyPlanesToByteArray produces (yuv420p: Y then U then V, no padding; rgba: interleaved). Size must be at least the format's buffer size for widthxheight.

The frame owns its buffers (close it or hand it to an encoder/filter, which closes it for you). ptsMicros sets the timestamp on a 1/1_000_000 time-base; FrameInfo.NOPTS leaves it unset (encoders then fall back to a frame counter).

Throws

on unknown pixel format, allocation failure, or short bytes

actual fun ofVideo(bytes: ByteArray, width: Int, height: Int, pixelFormat: PixelFormat, ptsMicros: Long): Frame

Build a video frame from raw pixel bytes. This is the entry point for generative use: images-to-video, procedural frames, and pixels produced by other libraries.

bytes must be tightly packed planes in pixelFormat's layout. That is exactly what copyPlanesToByteArray produces (yuv420p: Y then U then V, no padding; rgba: interleaved). Size must be at least the format's buffer size for widthxheight.

The frame owns its buffers (close it or hand it to an encoder/filter, which closes it for you). ptsMicros sets the timestamp on a 1/1_000_000 time-base; FrameInfo.NOPTS leaves it unset (encoders then fall back to a frame counter).

Throws

on unknown pixel format, allocation failure, or short bytes