Mp4Muxer.Builder


class Mp4Muxer.Builder


A builder for Mp4Muxer instances.

Summary

Public constructors

Builder(fileOutputStream: FileOutputStream!)

Creates a Builder instance with default values.

Public functions

Mp4Muxer!

Builds an Mp4Muxer instance.

Mp4Muxer.Builder!

Sets the AnnexBToAvccConverter to be used by the muxer to convert H.264 and H.265 NAL units from the Annex-B format (using start codes to delineate NAL units) to the AVCC format (which uses length prefixes).

Mp4Muxer.Builder!
@CanIgnoreReturnValue
setAttemptStreamableOutputEnabled(
    attemptStreamableOutputEnabled: Boolean
)

Sets whether to attempt to write a file where the metadata is stored at the start, which can make the file more efficient to read sequentially.

Mp4Muxer.Builder!

Sets the LastFrameDurationBehavior for the video track.

Mp4Muxer.Builder!

Sets whether to enable the sample copy.

Public constructors

Builder

Builder(fileOutputStream: FileOutputStream!)

Creates a Builder instance with default values.

Parameters
fileOutputStream: FileOutputStream!

The FileOutputStream to write the media data to.

Public functions

build

fun build(): Mp4Muxer!

Builds an Mp4Muxer instance.

setAnnexBToAvccConverter

@CanIgnoreReturnValue
fun setAnnexBToAvccConverter(annexBToAvccConverter: AnnexBToAvccConverter!): Mp4Muxer.Builder!

Sets the AnnexBToAvccConverter to be used by the muxer to convert H.264 and H.265 NAL units from the Annex-B format (using start codes to delineate NAL units) to the AVCC format (which uses length prefixes).

The default value is DEFAULT.

setAttemptStreamableOutputEnabled

@CanIgnoreReturnValue
fun setAttemptStreamableOutputEnabled(
    attemptStreamableOutputEnabled: Boolean
): Mp4Muxer.Builder!

Sets whether to attempt to write a file where the metadata is stored at the start, which can make the file more efficient to read sequentially.

Setting to true does not guarantee a streamable MP4 output.

The default value is true.

setLastFrameDurationBehavior

@CanIgnoreReturnValue
fun setLastFrameDurationBehavior(
    @Mp4Muxer.LastFrameDurationBehavior lastFrameDurationBehavior: Int
): Mp4Muxer.Builder!

Sets the LastFrameDurationBehavior for the video track.

The default value is LAST_FRAME_DURATION_BEHAVIOR_INSERT_SHORT_FRAME.

setSampleCopyEnabled

@CanIgnoreReturnValue
fun setSampleCopyEnabled(enabled: Boolean): Mp4Muxer.Builder!

Sets whether to enable the sample copy.

If the sample copy is enabled, writeSampleData copies the input ByteBuffer and BufferInfo before it returns, so it is safe to reuse them immediately. Otherwise, the muxer takes ownership of the and the BufferInfo and the caller must not modify them.

The default value is true.