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

Object clone()

Creates and returns a copy of this object.

boolean equals(Object obj)

Indicates whether some other object is "equal to" this one.

void finalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

final Class<?> getClass()

Returns the runtime class of this Object.

int hashCode()

Returns a hash code value for the object.

final void notify()

Wakes up a single thread that is waiting on this object's monitor.

final void notifyAll()

Wakes up all threads that are waiting on this object's monitor.

String toString()

Returns a string representation of the object.

final void wait(long timeoutMillis, int nanos)

Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

final void wait(long timeoutMillis)

Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

final void wait()

Causes the current thread to wait until it is awakened, typically by being notified or interrupted.

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

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.