public interface

Codec.EncoderFactory

 androidx.media3.transformer.Codec.EncoderFactory

Overview

A factory for encoder instances.

Summary

Fields
public static final Codec.EncoderFactoryDEFAULT

A default EncoderFactory implementation.

Methods
public CodeccreateForAudioEncoding(Format format, java.util.List<java.lang.String> allowedMimeTypes)

Returns a Codec for audio encoding.

public CodeccreateForVideoEncoding(Format format, java.util.List<java.lang.String> allowedMimeTypes)

Returns a Codec for video encoding.

Fields

public static final Codec.EncoderFactory DEFAULT

A default EncoderFactory implementation.

Methods

public Codec createForAudioEncoding(Format format, java.util.List<java.lang.String> allowedMimeTypes)

Returns a Codec for audio encoding.

This method must validate that the Codec is configured to produce one of the allowedMimeTypes. The sample MIME type given in format is not necessarily allowed.

Parameters:

format: The Format (of the output data) used to determine the underlying MediaCodec and its configuration values.
allowedMimeTypes: The non-empty list of allowed output sample MIME types.

Returns:

A configured and started encoder wrapper.

public Codec createForVideoEncoding(Format format, java.util.List<java.lang.String> allowedMimeTypes)

Returns a Codec for video encoding.

This method must validate that the Codec is configured to produce one of the allowedMimeTypes. The sample MIME type given in format is not necessarily allowed.

Parameters:

format: The Format (of the output data) used to determine the underlying MediaCodec and its configuration values. Format.sampleMimeType, Format.width and Format.height must be set to those of the desired output video format. Format.rotationDegrees should be 0. The video should always be in landscape orientation.
allowedMimeTypes: The non-empty list of allowed output sample MIME types.

Returns:

A configured and started encoder wrapper.