@UnstableApi
public final class WavMuxer implements Muxer


A muxer for creating a WAV container file.

This muxer supports muxing of AUDIO_RAW with PCM encodings.

Summary

Public constructors

WavMuxer(SeekableMuxerOutput seekableMuxerOutput)

Creates an instance.

Public methods

void

Adds metadata about the output file.

int
addTrack(Format format)

Adds a track of the given media format.

void

Closes the file.

void
writeSampleData(
    int trackId,
    ByteBuffer byteBuffer,
    BufferInfo bufferInfo
)

Writes encoded sample data.

Inherited methods

From java.lang.AutoCloseable
abstract void

Public constructors

WavMuxer

public WavMuxer(SeekableMuxerOutput seekableMuxerOutput)

Creates an instance.

Parameters
SeekableMuxerOutput seekableMuxerOutput

The SeekableMuxerOutput to write the media data to. It will be automatically closed by the muxer when close is called.

Public methods

addMetadataEntry

public void addMetadataEntry(Metadata.Entry metadataEntry)

Adds metadata about the output file.

addTrack

public 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.

Only a single audio track is supported.

close

public 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

public void writeSampleData(
    int trackId,
    ByteBuffer byteBuffer,
    BufferInfo bufferInfo
)

Writes encoded sample data.

The bufferInfo is ignored.