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!

Sets fragment duration for the fragmented MP4.

Mp4Muxer.Builder!

Sets whether to enable writing a fragmented MP4.

Mp4Muxer.Builder!

Sets the LastFrameDurationBehavior for the video track.

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.

setFragmentDurationUs

@CanIgnoreReturnValue
fun setFragmentDurationUs(fragmentDurationUs: Int): Mp4Muxer.Builder!

Sets fragment duration for the fragmented MP4.

Muxer will attempt to create fragments of the given duration but the actual duration might be greater depending upon the frequency of sync samples.

The duration is ignored for non fragmented MP4.

The default value is DEFAULT_FRAGMENT_DURATION_US.

Parameters
fragmentDurationUs: Int

The fragment duration in microseconds.

setFragmentedMp4Enabled

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

Sets whether to enable writing a fragmented MP4.

The default value is false.

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.