CamcorderProfilepublic class CamcorderProfile extends Object Retrieves the
predefined camcorder profile settings for camcorder applications.
These settings are read-only.
The compressed output from a recording session with a given
CamcorderProfile contains two tracks: one for audio and one for video.
Each profile specifies the following set of parameters:
- The file output format
- Video codec format
- Video bit rate in bits per second
- Video frame rate in frames per second
- Video frame width and height,
- Audio codec format
- Audio bit rate in bits per second,
- Audio sample rate
- Number of audio channels for recording.
|
Fields Summary |
---|
public static final int | QUALITY_LOWQuality level corresponding to the lowest available resolution. | public static final int | QUALITY_HIGHQuality level corresponding to the highest available resolution. | public static final int | QUALITY_QCIFQuality level corresponding to the qcif (176 x 144) resolution. | public static final int | QUALITY_CIFQuality level corresponding to the cif (352 x 288) resolution. | public static final int | QUALITY_480PQuality level corresponding to the 480p (720 x 480) resolution.
Note that the horizontal resolution for 480p can also be other
values, such as 640 or 704, instead of 720. | public static final int | QUALITY_720PQuality level corresponding to the 720p (1280 x 720) resolution. | public static final int | QUALITY_1080PQuality level corresponding to the 1080p (1920 x 1080) resolution.
Note that the vertical resolution for 1080p can also be 1088,
instead of 1080 (used by some vendors to avoid cropping during
video playback). | public static final int | QUALITY_QVGAQuality level corresponding to the QVGA (320x240) resolution. | public static final int | QUALITY_2160PQuality level corresponding to the 2160p (3840x2160) resolution. | private static final int | QUALITY_LIST_START | private static final int | QUALITY_LIST_END | public static final int | QUALITY_TIME_LAPSE_LOWTime lapse quality level corresponding to the lowest available resolution. | public static final int | QUALITY_TIME_LAPSE_HIGHTime lapse quality level corresponding to the highest available resolution. | public static final int | QUALITY_TIME_LAPSE_QCIFTime lapse quality level corresponding to the qcif (176 x 144) resolution. | public static final int | QUALITY_TIME_LAPSE_CIFTime lapse quality level corresponding to the cif (352 x 288) resolution. | public static final int | QUALITY_TIME_LAPSE_480PTime lapse quality level corresponding to the 480p (720 x 480) resolution. | public static final int | QUALITY_TIME_LAPSE_720PTime lapse quality level corresponding to the 720p (1280 x 720) resolution. | public static final int | QUALITY_TIME_LAPSE_1080PTime lapse quality level corresponding to the 1080p (1920 x 1088) resolution. | public static final int | QUALITY_TIME_LAPSE_QVGATime lapse quality level corresponding to the QVGA (320 x 240) resolution. | public static final int | QUALITY_TIME_LAPSE_2160PTime lapse quality level corresponding to the 2160p (3840 x 2160) resolution. | private static final int | QUALITY_TIME_LAPSE_LIST_START | private static final int | QUALITY_TIME_LAPSE_LIST_END | public static final int | QUALITY_HIGH_SPEED_LOWHigh speed ( >= 100fps) quality level corresponding to the lowest available resolution. | public static final int | QUALITY_HIGH_SPEED_HIGHHigh speed ( >= 100fps) quality level corresponding to the highest available resolution. | public static final int | QUALITY_HIGH_SPEED_480PHigh speed ( >= 100fps) quality level corresponding to the 480p (720 x 480) resolution.
Note that the horizontal resolution for 480p can also be other
values, such as 640 or 704, instead of 720. | public static final int | QUALITY_HIGH_SPEED_720PHigh speed ( >= 100fps) quality level corresponding to the 720p (1280 x 720) resolution. | public static final int | QUALITY_HIGH_SPEED_1080PHigh speed ( >= 100fps) quality level corresponding to the 1080p (1920 x 1080 or 1920x1088)
resolution. | public static final int | QUALITY_HIGH_SPEED_2160PHigh speed ( >= 100fps) quality level corresponding to the 2160p (3840 x 2160)
resolution. | private static final int | QUALITY_HIGH_SPEED_LIST_START | private static final int | QUALITY_HIGH_SPEED_LIST_END | public int | durationDefault recording duration in seconds before the session is terminated.
This is useful for applications like MMS has limited file size requirement. | public int | qualityThe quality level of the camcorder profile | public int | fileFormatThe file output format of the camcorder profile | public int | videoCodecThe video encoder being used for the video track | public int | videoBitRateThe target video output bit rate in bits per second | public int | videoFrameRateThe target video frame rate in frames per second | public int | videoFrameWidthThe target video frame width in pixels | public int | videoFrameHeightThe target video frame height in pixels | public int | audioCodecThe audio encoder being used for the audio track. | public int | audioBitRateThe target audio output bit rate in bits per second | public int | audioSampleRateThe audio sampling rate used for the audio track | public int | audioChannelsThe number of audio channels used for the audio track |
Constructors Summary |
---|
private CamcorderProfile(int duration, int quality, int fileFormat, int videoCodec, int videoBitRate, int videoFrameRate, int videoWidth, int videoHeight, int audioCodec, int audioBitRate, int audioSampleRate, int audioChannels)
System.loadLibrary("media_jni");
native_init();
this.duration = duration;
this.quality = quality;
this.fileFormat = fileFormat;
this.videoCodec = videoCodec;
this.videoBitRate = videoBitRate;
this.videoFrameRate = videoFrameRate;
this.videoFrameWidth = videoWidth;
this.videoFrameHeight = videoHeight;
this.audioCodec = audioCodec;
this.audioBitRate = audioBitRate;
this.audioSampleRate = audioSampleRate;
this.audioChannels = audioChannels;
|
Methods Summary |
---|
public static android.media.CamcorderProfile | get(int quality)Returns the camcorder profile for the first back-facing camera on the
device at the given quality level. If the device has no back-facing
camera, this returns null.
int numberOfCameras = Camera.getNumberOfCameras();
CameraInfo cameraInfo = new CameraInfo();
for (int i = 0; i < numberOfCameras; i++) {
Camera.getCameraInfo(i, cameraInfo);
if (cameraInfo.facing == CameraInfo.CAMERA_FACING_BACK) {
return get(i, quality);
}
}
return null;
| public static android.media.CamcorderProfile | get(int cameraId, int quality)Returns the camcorder profile for the given camera at the given
quality level.
Quality levels QUALITY_LOW, QUALITY_HIGH are guaranteed to be supported, while
other levels may or may not be supported. The supported levels can be checked using
{@link #hasProfile(int, int)}.
QUALITY_LOW refers to the lowest quality available, while QUALITY_HIGH refers to
the highest quality available.
QUALITY_LOW/QUALITY_HIGH have to match one of qcif, cif, 480p, 720p, 1080p or 2160p.
E.g. if the device supports 480p, 720p, 1080p and 2160p, then low is 480p and high is
2160p.
The same is true for time lapse quality levels, i.e. QUALITY_TIME_LAPSE_LOW,
QUALITY_TIME_LAPSE_HIGH are guaranteed to be supported and have to match one of
qcif, cif, 480p, 720p, 1080p, or 2160p.
For high speed quality levels, they may or may not be supported. If a subset of the levels
are supported, QUALITY_HIGH_SPEED_LOW and QUALITY_HIGH_SPEED_HIGH are guaranteed to be
supported and have to match one of 480p, 720p, or 1080p.
A camcorder recording session with higher quality level usually has higher output
bit rate, better video and/or audio recording quality, larger video frame
resolution and higher audio sampling rate, etc, than those with lower quality
level.
if (!((quality >= QUALITY_LIST_START &&
quality <= QUALITY_LIST_END) ||
(quality >= QUALITY_TIME_LAPSE_LIST_START &&
quality <= QUALITY_TIME_LAPSE_LIST_END) ||
(quality >= QUALITY_HIGH_SPEED_LIST_START &&
quality <= QUALITY_HIGH_SPEED_LIST_END))) {
String errMessage = "Unsupported quality level: " + quality;
throw new IllegalArgumentException(errMessage);
}
return native_get_camcorder_profile(cameraId, quality);
| public static boolean | hasProfile(int quality)Returns true if camcorder profile exists for the first back-facing
camera at the given quality level.
When using the Camera 2 API in {@code LEGACY} mode (i.e. when
{@link android.hardware.camera2.CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL} is set
to
{@link android.hardware.camera2.CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_LEGACY}),
{@link #hasProfile} may return {@code true} for unsupported resolutions. To ensure a
a given resolution is supported in LEGACY mode, the configuration given in
{@link android.hardware.camera2.CameraCharacteristics#SCALER_STREAM_CONFIGURATION_MAP}
must contain the the resolution in the supported output sizes. The recommended way to check
this is with
{@link android.hardware.camera2.params.StreamConfigurationMap#getOutputSizes(Class)} with the
class of the desired recording endpoint, and check that the desired resolution is contained
in the list returned.
int numberOfCameras = Camera.getNumberOfCameras();
CameraInfo cameraInfo = new CameraInfo();
for (int i = 0; i < numberOfCameras; i++) {
Camera.getCameraInfo(i, cameraInfo);
if (cameraInfo.facing == CameraInfo.CAMERA_FACING_BACK) {
return hasProfile(i, quality);
}
}
return false;
| public static boolean | hasProfile(int cameraId, int quality)Returns true if camcorder profile exists for the given camera at
the given quality level.
When using the Camera 2 API in LEGACY mode (i.e. when
{@link android.hardware.camera2.CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL} is set
to
{@link android.hardware.camera2.CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_LEGACY}),
{@link #hasProfile} may return {@code true} for unsupported resolutions. To ensure a
a given resolution is supported in LEGACY mode, the configuration given in
{@link android.hardware.camera2.CameraCharacteristics#SCALER_STREAM_CONFIGURATION_MAP}
must contain the the resolution in the supported output sizes. The recommended way to check
this is with
{@link android.hardware.camera2.params.StreamConfigurationMap#getOutputSizes(Class)} with the
class of the desired recording endpoint, and check that the desired resolution is contained
in the list returned.
return native_has_camcorder_profile(cameraId, quality);
| private static final native android.media.CamcorderProfile | native_get_camcorder_profile(int cameraId, int quality)
| private static final native boolean | native_has_camcorder_profile(int cameraId, int quality)
| private static final native void | native_init()
|
|