encode

fun SoftwareReadableFrame.encode(format: SnapshotFormat = SnapshotFormat.Jpeg): ByteArray

Encodes a frame with readable planes as a standalone image: a CapturedFrame from KitePlayer.captureFrame, or any software frame a backend produced.

Runs the pixel conversion FFmpeg needs on the calling thread and leaves this frame untouched. A hardware frame that is read through a downloaded copy, such as a VideoToolbox frame, encodes that copy.

Throws

for a frame whose pixel format has no FFmpeg name

io.github.yuroyami.kiteffmpeg.FFmpegException

when the encoder refuses the frame