VideoProfile
class VideoProfile
kotlin.Any | |
↳ | android.media.EncoderProfiles.VideoProfile |
Configuration for a video encoder.
Summary
Constants | |
---|---|
static Int |
Dolby Vision |
static Int |
HDR10. |
static Int |
HDR10+. |
static Int |
HLG (Hybrid-Log Gamma). |
static Int |
Not HDR (SDR). |
static Int |
YUV 4:2:0. |
static Int |
YUV 4:2:2. |
static Int |
YUV 4:4:4. |
Public methods | |
---|---|
Int |
The bit depth of the encoded video. |
Int |
The target video output bitrate in bits per second |
Int |
The chroma subsampling of the encoded video. |
Int |
getCodec() The video encoder being used for the video track |
Int |
The target video frame rate in frames per second. |
Int |
The HDR format of the encoded video. |
Int |
The target video frame height in pixels |
String |
The media type of the video encoder being used for the video track |
Int |
The video encoder profile being used for the video track. |
Int |
getWidth() The target video frame width in pixels |
Constants
HDR_DOLBY_VISION
static val HDR_DOLBY_VISION: Int
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.
Value: 4
See Also
HDR_HDR10
static val HDR_HDR10: Int
HDR10.
An HDR format specifying HDR10.
Value: 2
HDR_HDR10PLUS
static val HDR_HDR10PLUS: Int
HDR10+.
An HDR format specifying HDR10+.
Value: 3
HDR_HLG
static val HDR_HLG: Int
HLG (Hybrid-Log Gamma).
An HDR format specifying HLG.
Value: 1
HDR_NONE
static val HDR_NONE: Int
Not HDR (SDR).
An HDR format specifying SDR (Standard Dynamic Range) recording.
Value: 0
YUV_420
static val YUV_420: Int
YUV 4:2:0.
A chroma subsampling where the U and V planes are subsampled by 2 both horizontally and vertically.
Value: 0
YUV_422
static val YUV_422: Int
YUV 4:2:2.
A chroma subsampling where the U and V planes are subsampled by 2 horizontally alone.
Value: 1
YUV_444
static val YUV_444: Int
YUV 4:4:4.
A chroma subsampling where the U and V planes are not subsampled.
Value: 2
Public methods
getBitDepth
fun getBitDepth(): Int
The bit depth of the encoded video.
This value is effectively 8 or 10, but some devices may support additional values.
getBitrate
fun getBitrate(): Int
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 android.media.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 android.media.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.
getChromaSubsampling
fun getChromaSubsampling(): Int
The chroma subsampling of the encoded video.
For most devices this is always YUV_420 but some devices may support additional values.
Return | |
---|---|
Int |
Value is android.media.EncoderProfiles.VideoProfile#YUV_420 , android.media.EncoderProfiles.VideoProfile#YUV_422 , or android.media.EncoderProfiles.VideoProfile#YUV_444 |
getCodec
fun getCodec(): Int
The video encoder being used for the video track
getFrameRate
fun getFrameRate(): Int
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 android.media.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 android.media.MediaRecorder#setVideoFrameRate
. For example, if android.media.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 android.media.MediaRecorder#setVideoFrameRate
. 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.
getHdrFormat
fun getHdrFormat(): Int
The HDR format of the encoded video.
This is one of the HDR_ values.
getMediaType
fun getMediaType(): String
The media type of the video encoder being used for the video track
Return | |
---|---|
String |
This value cannot be null . |
See Also
getProfile
fun getProfile(): Int
The video encoder profile being used for the video track.
This value is negative if there is no profile defined for the video codec.