EncoderProfiles


public final class EncoderProfiles
extends Object

java.lang.Object
   ↳ android.media.EncoderProfiles


Describes a set of encoding profiles for a given media (audio and/or video) profile. These settings are read-only.

Currently, this is used to describe camera recording profile with more detail than CamcorderProfile, by providing encoding parameters for more than just the default audio and/or video codec.

The compressed output from a camera recording session contains two tracks: one for audio and one for video.

In the future audio-only recording profiles may be defined.

Each media profile specifies a set of audio and a set of video specific settings.

  • The file output format
  • Default file duration

    Video-specific settings are:

  • Video codec format
  • Video bit rate in bits per second
  • Video frame rate in frames per second
  • Video frame width and height,
  • Video encoder profile.

    Audio-specific settings are:

  • Audio codec format
  • Audio bit rate in bits per second,
  • Audio sample rate
  • Number of audio channels for recording.

Summary

Nested classes

class EncoderProfiles.AudioProfile

Configuration for an audio encoder. 

class EncoderProfiles.VideoProfile

Configuration for a video encoder. 

Public methods

List<EncoderProfiles.AudioProfile> getAudioProfiles()

Returns the defined audio encoder profiles.

int getDefaultDurationSeconds()

Default recording duration in seconds before the session is terminated.

int getRecommendedFileFormat()

Recommended output file format

List<EncoderProfiles.VideoProfile> getVideoProfiles()

Returns the defined video encoder profiles.

Inherited methods

Public methods

getAudioProfiles

Added in API level 31
public List<EncoderProfiles.AudioProfile> getAudioProfiles ()

Returns the defined audio encoder profiles.

The list may be empty. This means there are no audio encoder profiles defined. Otherwise, the first profile is the default audio profile.

Returns
List<EncoderProfiles.AudioProfile> This value cannot be null.

getDefaultDurationSeconds

Added in API level 31
public int getDefaultDurationSeconds ()

Default recording duration in seconds before the session is terminated. This is useful for applications like MMS that have a limited file size requirement. This could be 0 if there is no default recording duration.

Returns
int

getRecommendedFileFormat

Added in API level 31
public int getRecommendedFileFormat ()

Recommended output file format

Returns
int Value is MediaRecorder.OutputFormat.DEFAULT, MediaRecorder.OutputFormat.THREE_GPP, MediaRecorder.OutputFormat.MPEG_4, MediaRecorder.OutputFormat.AMR_NB, MediaRecorder.OutputFormat.AMR_WB, android.media.MediaRecorder.OutputFormat.AAC_ADIF, MediaRecorder.OutputFormat.AAC_ADTS, MediaRecorder.OutputFormat.MPEG_2_TS, MediaRecorder.OutputFormat.WEBM, android.media.MediaRecorder.OutputFormat.HEIF, or MediaRecorder.OutputFormat.OGG

getVideoProfiles

Added in API level 31
public List<EncoderProfiles.VideoProfile> getVideoProfiles ()

Returns the defined video encoder profiles.

The list may be empty. This means there are no video encoder profiles defined. Otherwise, the first profile is the default video profile.

Returns
List<EncoderProfiles.VideoProfile> This value cannot be null.