MediaSink

expect class MediaSink : AutoCloseable

An open output file (muxer). Add every encoder first, video and audio, because the muxer's header freezes the stream list. Then push frames through the encoders. Close the sink to write the trailer and flush buffers.

actual class MediaSink : AutoCloseable

An open output file (muxer). Add every encoder first, video and audio, because the muxer's header freezes the stream list. Then push frames through the encoders. Close the sink to write the trailer and flush buffers.

actual class MediaSink : AutoCloseable

An open output file (muxer). Add every encoder first, video and audio, because the muxer's header freezes the stream list. Then push frames through the encoders. Close the sink to write the trailer and flush buffers.

actual class MediaSink : AutoCloseable

An open output file (muxer). Add every encoder first, video and audio, because the muxer's header freezes the stream list. Then push frames through the encoders. Close the sink to write the trailer and flush buffers.

Types

Link copied to clipboard
expect object Companion

Opens sinks.

actual object Companion

Opens sinks.

actual object Companion

Opens sinks.

actual object Companion

Opens sinks.

Functions

Link copied to clipboard

Add an audio encoder. Must be called before any frame is written.

Add an audio encoder. Must be called before any frame is written.

Add an audio encoder. Must be called before any frame is written.

Add an audio encoder. Must be called before any frame is written.

Link copied to clipboard
expect fun addCopyStream(source: MediaSource, stream: StreamInfo): CopyStream

Add an output stream that copies stream's packets verbatim from source: no decode, no re-encode, only timestamp rescaling into the output's time-base (ffmpeg -c copy). A format pair that needs a bitstream filter, such as H.264 in MP4 to MPEG-TS, gets it automatically when the packets are written.

actual fun addCopyStream(source: MediaSource, stream: StreamInfo): CopyStream

Add an output stream that copies stream's packets verbatim from source: no decode, no re-encode, only timestamp rescaling into the output's time-base (ffmpeg -c copy). A format pair that needs a bitstream filter, such as H.264 in MP4 to MPEG-TS, gets it automatically when the packets are written.

actual fun addCopyStream(source: MediaSource, stream: StreamInfo): CopyStream

Add an output stream that copies stream's packets verbatim from source: no decode, no re-encode, only timestamp rescaling into the output's time-base (ffmpeg -c copy). A format pair that needs a bitstream filter, such as H.264 in MP4 to MPEG-TS, gets it automatically when the packets are written.

actual fun addCopyStream(source: MediaSource, stream: StreamInfo): CopyStream

Add an output stream that copies stream's packets verbatim from source: no decode, no re-encode, only timestamp rescaling into the output's time-base (ffmpeg -c copy). A format pair that needs a bitstream filter, such as H.264 in MP4 to MPEG-TS, gets it automatically when the packets are written.

Link copied to clipboard

Add a video encoder. Must be called before any frame is written.

Add a video encoder. Must be called before any frame is written.

Add a video encoder. Must be called before any frame is written.

Add a video encoder. Must be called before any frame is written.

Link copied to clipboard
expect open override fun close()

Flushes every encoder, writes the trailer, and frees the muxer.

actual open override fun close()

Flushes every encoder, writes the trailer, and frees the muxer.

actual open override fun close()

Flushes every encoder, writes the trailer, and frees the muxer.

actual open override fun close()

Flushes every encoder, writes the trailer, and frees the muxer.

Link copied to clipboard
expect fun setChapters(chapters: List<Chapter>)

Chapters for the output, each with its title and its other tags. Call this before any frame or packet is written. The bounds are on the output's own timeline, whose zero is the earliest source time the output shows: the earliest presentation time of the copied audio and video, counting the samples a stream skips at its start, or the first encoded frame when that is earlier. A caller copying chapters from a MediaSource subtracts that time. For a copy cut between keyframes it is the keyframe before the cut, not the cut itself. A chapter Chapter.id only has to be unique within the list.

actual fun setChapters(chapters: List<Chapter>)

Chapters for the output, each with its title and its other tags. Call this before any frame or packet is written. The bounds are on the output's own timeline, whose zero is the earliest source time the output shows: the earliest presentation time of the copied audio and video, counting the samples a stream skips at its start, or the first encoded frame when that is earlier. A caller copying chapters from a MediaSource subtracts that time. For a copy cut between keyframes it is the keyframe before the cut, not the cut itself. A chapter Chapter.id only has to be unique within the list.

actual fun setChapters(chapters: List<Chapter>)

Chapters for the output, each with its title and its other tags. Call this before any frame or packet is written. The bounds are on the output's own timeline, whose zero is the earliest source time the output shows: the earliest presentation time of the copied audio and video, counting the samples a stream skips at its start, or the first encoded frame when that is earlier. A caller copying chapters from a MediaSource subtracts that time. For a copy cut between keyframes it is the keyframe before the cut, not the cut itself. A chapter Chapter.id only has to be unique within the list.

actual fun setChapters(chapters: List<Chapter>)

Chapters for the output, each with its title and its other tags. Call this before any frame or packet is written. The bounds are on the output's own timeline, whose zero is the earliest source time the output shows: the earliest presentation time of the copied audio and video, counting the samples a stream skips at its start, or the first encoded frame when that is earlier. A caller copying chapters from a MediaSource subtracts that time. For a copy cut between keyframes it is the keyframe before the cut, not the cut itself. A chapter Chapter.id only has to be unique within the list.

Link copied to clipboard
expect fun setMetadata(metadata: Map<String, String>)

Container-level metadata tags (title, artist, comment, …). Call this before any frame or packet is written, because the tags are stored in the header.

actual fun setMetadata(metadata: Map<String, String>)

Container-level metadata tags (title, artist, comment, …). Call this before any frame or packet is written, because the tags are stored in the header.

actual fun setMetadata(metadata: Map<String, String>)

Container-level metadata tags (title, artist, comment, …). Call this before any frame or packet is written, because the tags are stored in the header.

actual fun setMetadata(metadata: Map<String, String>)

Container-level metadata tags (title, artist, comment, …). Call this before any frame or packet is written, because the tags are stored in the header.