Mp4Muxer.Builder
class Mp4Muxer.Builder
A builder for Mp4Muxer
instances.
Summary
Public constructors |
---|
Builder(outputStream: FileOutputStream!) Creates a |
Public functions |
|
---|---|
Mp4Muxer! |
build() Builds an |
Mp4Muxer.Builder! |
@CanIgnoreReturnValue Sets the |
Mp4Muxer.Builder! |
@CanIgnoreReturnValue 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! |
@CanIgnoreReturnValue Sets the |
Mp4Muxer.Builder! |
@CanIgnoreReturnValue Sets the |
Mp4Muxer.Builder! |
@CanIgnoreReturnValue Sets the specific MP4 file format. |
Mp4Muxer.Builder! |
Sets whether to enable sample batching. |
Mp4Muxer.Builder! |
Sets whether to enable the sample copy. |
Public constructors
Builder
Builder(outputStream: FileOutputStream!)
Creates a Builder
instance with default values.
Parameters | |
---|---|
outputStream: FileOutputStream! |
The |
Public functions
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
.
setLastSampleDurationBehavior
@CanIgnoreReturnValue
fun setLastSampleDurationBehavior(
@Mp4Muxer.LastSampleDurationBehavior lastSampleDurationBehavior: Int
): Mp4Muxer.Builder!
Sets the LastSampleDurationBehavior
.
The default value is LAST_SAMPLE_DURATION_BEHAVIOR_SET_FROM_END_OF_STREAM_BUFFER_OR_DUPLICATE_PREVIOUS
.
setMp4AtFileParameters
@CanIgnoreReturnValue
fun setMp4AtFileParameters(
mp4AtFileParameters: Mp4Muxer.Mp4AtFileParameters!
): Mp4Muxer.Builder!
Sets the Mp4AtFileParameters
.
setOutputFileFormat
@CanIgnoreReturnValue
fun setOutputFileFormat(@Mp4Muxer.FileFormat fileFormat: Int): Mp4Muxer.Builder!
Sets the specific MP4 file format.
The default value is FILE_FORMAT_DEFAULT
.
For FILE_FORMAT_MP4_WITH_AUXILIARY_TRACKS_EXTENSION
, Mp4AtFileParameters
must also be setMp4AtFileParameters
set}.
setSampleBatchingEnabled
@CanIgnoreReturnValue
fun setSampleBatchingEnabled(enabled: Boolean): Mp4Muxer.Builder!
Sets whether to enable sample batching.
If sample batching is enabled, samples are written in batches for each track, otherwise samples are written as they arrive
.
When sample batching is enabled, and sample copying
is disabled the ByteBuffer
contents provided to writeSampleData
should not be modified. Otherwise, if sample batching is disabled or sample copying is enabled, the sample data
contents can be modified after calling writeSampleData
.
The default value is false
.
setSampleCopyingEnabled
@CanIgnoreReturnValue
fun setSampleCopyingEnabled(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 ByteBuffer
and the BufferInfo
and the caller must not modify them.
When sample batching
is disabled, samples are written as they arrive
and sample copying is disabled.
The default value is false
.