EncoderProfiles.VideoProfile


public static final class EncoderProfiles.VideoProfile
extends Object

java.lang.Object
   ↳ android.media.EncoderProfiles.VideoProfile


Configuration for a video encoder.

Summary

Constants

int HDR_DOLBY_VISION

Dolby Vision

An HDR format specifying Dolby Vision.

int HDR_HDR10

HDR10.

int HDR_HDR10PLUS

HDR10+.

int HDR_HLG

HLG (Hybrid-Log Gamma).

int HDR_NONE

Not HDR (SDR).

int YUV_420

YUV 4:2:0.

int YUV_422

YUV 4:2:2.

int YUV_444

YUV 4:4:4.

Public methods

int getBitDepth()

The bit depth of the encoded video.

int getBitrate()

The target video output bitrate in bits per second

This is the target recorded video output bitrate if the application configures the video recording via MediaRecorder#setProfile without specifying any other MediaRecorder encoding parameters.

int getChromaSubsampling()

The chroma subsampling of the encoded video.

int getCodec()

The video encoder being used for the video track

int getFrameRate()

The target video frame rate in frames per second.

int getHdrFormat()

The HDR format of the encoded video.

int getHeight()

The target video frame height in pixels

String getMediaType()

The media type of the video encoder being used for the video track

int getProfile()

The video encoder profile being used for the video track.

int getWidth()

The target video frame width in pixels

Inherited methods

Constants

HDR_DOLBY_VISION

Added in API level 33
public static final int HDR_DOLBY_VISION

Dolby Vision

An HDR format specifying Dolby Vision. For this format the codec is always a Dolby Vision encoder. The encoder profile specifies which Dolby Vision version is being used.

See also:

Constant Value: 4 (0x00000004)

HDR_HDR10

Added in API level 33
public static final int HDR_HDR10

HDR10.

An HDR format specifying HDR10.

Constant Value: 2 (0x00000002)

HDR_HDR10PLUS

Added in API level 33
public static final int HDR_HDR10PLUS

HDR10+.

An HDR format specifying HDR10+.

Constant Value: 3 (0x00000003)

HDR_HLG

Added in API level 33
public static final int HDR_HLG

HLG (Hybrid-Log Gamma).

An HDR format specifying HLG.

Constant Value: 1 (0x00000001)

HDR_NONE

Added in API level 33
public static final int HDR_NONE

Not HDR (SDR).

An HDR format specifying SDR (Standard Dynamic Range) recording.

Constant Value: 0 (0x00000000)

YUV_420

Added in API level 33
public static final int YUV_420

YUV 4:2:0.

A chroma subsampling where the U and V planes are subsampled by 2 both horizontally and vertically.

Constant Value: 0 (0x00000000)

YUV_422

Added in API level 33
public static final int YUV_422

YUV 4:2:2.

A chroma subsampling where the U and V planes are subsampled by 2 horizontally alone.

Constant Value: 1 (0x00000001)

YUV_444

Added in API level 33
public static final int YUV_444

YUV 4:4:4.

A chroma subsampling where the U and V planes are not subsampled.

Constant Value: 2 (0x00000002)

Public methods

getBitDepth

Added in API level 33
public int getBitDepth ()

The bit depth of the encoded video.

This value is effectively 8 or 10, but some devices may support additional values.

Returns
int

getBitrate

Added in API level 31
public int getBitrate ()

The target video output bitrate in bits per second

This is the target recorded video output bitrate if the application configures the video recording via MediaRecorder#setProfile without specifying any other MediaRecorder encoding parameters. For example, for high speed quality profiles (from CamcorderProfile#QUALITY_HIGH_SPEED_LOW to CamcorderProfile.QUALITY_HIGH_SPEED_2160P), this is the bitrate where the video is recorded with. If the application intends to record slow motion videos with the high speed quality profiles, it must set a different video bitrate that is corresponding to the desired recording output bit rate (i.e., the encoded video bitrate during normal playback) via MediaRecorder#setVideoEncodingBitRate. For example, if CamcorderProfile.QUALITY_HIGH_SPEED_720P advertises 240fps getFrameRate() and 64Mbps getBitrate() in the high speed VideoProfile, and the application intends to record 1/8 factor slow motion recording videos, the application must set 30fps via MediaRecorder#setVideoFrameRate and 8Mbps ( getBitrate() * slow motion factor) via MediaRecorder#setVideoEncodingBitRate. Failing to do so will result in videos with unexpected frame rate and bit rate, or MediaRecorder error if the output bit rate exceeds the encoder limit. If the application intends to do the video recording with MediaCodec encoder, it must set each individual field of MediaFormat similarly according to this VideoProfile.

Returns
int

getChromaSubsampling

Added in API level 33
public int getChromaSubsampling ()

The chroma subsampling of the encoded video.

For most devices this is always YUV_420 but some devices may support additional values.

Returns
int Value is YUV_420, YUV_422, or YUV_444

getFrameRate

Added in API level 31
public int getFrameRate ()

The target video frame rate in frames per second.

This is the target recorded video output frame rate per second if the application configures the video recording via MediaRecorder#setProfile without specifying any other MediaRecorder encoding parameters. For example, for high speed quality profiles (from CamcorderProfile#QUALITY_HIGH_SPEED_LOW to CamcorderProfile.QUALITY_HIGH_SPEED_2160P), this is the frame rate where the video is recorded and played back with. If the application intends to create slow motion use case with the high speed quality profiles, it must set a different video frame rate that is corresponding to the desired output (playback) frame rate via MediaRecorder.setVideoFrameRate(int). For example, if CamcorderProfile.QUALITY_HIGH_SPEED_720P advertises 240fps getFrameRate() in the VideoProfile, and the application intends to create 1/8 factor slow motion recording videos, the application must set 30fps via MediaRecorder.setVideoFrameRate(int). Failing to do so will result in high speed videos with normal speed playback frame rate (240fps for above example). If the application intends to do the video recording with MediaCodec encoder, it must set each individual field of MediaFormat similarly according to this VideoProfile.

Returns
int

getHdrFormat

Added in API level 33
public int getHdrFormat ()

The HDR format of the encoded video.

This is one of the HDR_ values.

Returns
int Value is HDR_NONE, HDR_HLG, HDR_HDR10, HDR_HDR10PLUS, or HDR_DOLBY_VISION

getHeight

Added in API level 31
public int getHeight ()

The target video frame height in pixels

Returns
int

getMediaType

Added in API level 31
public String getMediaType ()

The media type of the video encoder being used for the video track

Returns
String This value cannot be null.

getProfile

Added in API level 31
public int getProfile ()

The video encoder profile being used for the video track.

This value is negative if there is no profile defined for the video codec.

Returns
int

getWidth

Added in API level 31
public int getWidth ()

The target video frame width in pixels

Returns
int