Muxer
@UnstableApi
public interface Muxer extends AutoCloseable
AacMuxer |
A muxer for creating an AAC (Advanced Audio Coding) container file. |
DefaultMuxer |
A default |
FragmentedMp4Muxer |
A muxer for creating a fragmented MP4 file. |
FrameworkMuxer |
|
InAppFragmentedMp4Muxer |
|
InAppMp4Muxer |
|
Mp4Muxer |
A muxer for creating an MP4 container file. |
WebmMuxer |
A muxer for creating a WebM container file. |
A muxer for producing media container files.
Summary
Nested types |
|---|
public interface Muxer.FactoryFactory for muxers. |
Public methods |
|
|---|---|
abstract void |
addMetadataEntry(Metadata.Entry metadataEntry)Adds |
abstract int |
Adds a track of the given media format. |
abstract void |
close()Closes the file. |
abstract void |
writeSampleData(Writes encoded sample data. |
Public methods
addMetadataEntry
abstract void addMetadataEntry(Metadata.Entry metadataEntry)
Adds metadata about the output file.
addTrack
abstract int addTrack(Format format)
Adds a track of the given media format.
All tracks must be added before any samples are written to any track.
| Returns | |
|---|---|
int |
A track id for this track, which should be passed to |
| Throws | |
|---|---|
androidx.media3.muxer.MuxerException |
If the muxer encounters a problem while adding the track. |
close
abstract void close()
Closes the file.
The muxer cannot be used anymore once this method returns.
| Throws | |
|---|---|
androidx.media3.muxer.MuxerException |
If the muxer fails to finish writing the output. |
writeSampleData
abstract void writeSampleData(
int trackId,
ByteBuffer byteBuffer,
BufferInfo bufferInfo
)
Writes encoded sample data.
| Parameters | |
|---|---|
int trackId |
The track id, previously returned by |
ByteBuffer byteBuffer |
A buffer containing the sample data to write to the container. |
BufferInfo bufferInfo |
The |
| Throws | |
|---|---|
androidx.media3.muxer.MuxerException |
If the muxer fails to write the sample. |