VideoEncoder

One configured and opened video encoder. Pull from a Flow<Frame> via drive. That call pushes each frame into the encoder, pulls packets, hands them to the sink's muxer, and flushes when the flow completes.

Incoming frame pts are rescaled from the frame's own time-base onto the encoder's, which has one tick per frame at VideoEncoderSpec.frameRate. A frame whose pts lands on or before the tick of the frame before it is refused with FFmpegException, because moving it later would slow the video down: feed frames at the encoder's rate, dropping or repeating them first when the source is faster or slower, as Transcoder does. Frames without pts fall back to a frame counter.

One configured and opened video encoder. Pull from a Flow<Frame> via drive. That call pushes each frame into the encoder, pulls packets, hands them to the sink's muxer, and flushes when the flow completes.

Incoming frame pts are rescaled from the frame's own time-base onto the encoder's, which has one tick per frame at VideoEncoderSpec.frameRate. A frame whose pts lands on or before the tick of the frame before it is refused with FFmpegException, because moving it later would slow the video down: feed frames at the encoder's rate, dropping or repeating them first when the source is faster or slower, as Transcoder does. Frames without pts fall back to a frame counter.

One configured and opened video encoder. Pull from a Flow<Frame> via drive. That call pushes each frame into the encoder, pulls packets, hands them to the sink's muxer, and flushes when the flow completes.

Incoming frame pts are rescaled from the frame's own time-base onto the encoder's, which has one tick per frame at VideoEncoderSpec.frameRate. A frame whose pts lands on or before the tick of the frame before it is refused with FFmpegException, because moving it later would slow the video down: feed frames at the encoder's rate, dropping or repeating them first when the source is faster or slower, as Transcoder does. Frames without pts fall back to a frame counter.

One configured and opened video encoder. Pull from a Flow<Frame> via drive. That call pushes each frame into the encoder, pulls packets, hands them to the sink's muxer, and flushes when the flow completes.

Incoming frame pts are rescaled from the frame's own time-base onto the encoder's, which has one tick per frame at VideoEncoderSpec.frameRate. A frame whose pts lands on or before the tick of the frame before it is refused with FFmpegException, because moving it later would slow the video down: feed frames at the encoder's rate, dropping or repeating them first when the source is faster or slower, as Transcoder does. Frames without pts fall back to a frame counter.

Functions

Link copied to clipboard
expect open override fun close()
actual open override fun close()
actual open override fun close()
actual open override fun close()
Link copied to clipboard
expect suspend fun drive(input: Flow<Frame>, onProgress: (framesEncoded: Long) -> Unit? = null, progressEveryNFrames: Int = 30)

Drain input into this encoder + the parent muxer. Returns when the flow completes. Reports progress every progressEveryNFrames via onProgress (the encoded-frame count).

actual suspend fun drive(input: Flow, onProgress: (framesEncoded: Long) -> Unit?, progressEveryNFrames: Int)
actual suspend fun drive(input: Flow<Frame>, onProgress: (framesEncoded: Long) -> Unit?, progressEveryNFrames: Int)

Drain input into this encoder + the parent muxer. Returns when the flow completes. Reports progress every progressEveryNFrames via onProgress (the encoded-frame count).

actual suspend fun drive(input: Flow<Frame>, onProgress: (framesEncoded: Long) -> Unit?, progressEveryNFrames: Int)

Drain input into this encoder + the parent muxer. Returns when the flow completes. Reports progress every progressEveryNFrames via onProgress (the encoded-frame count).