# Recorder

Artifact: [androidx.camera:camera-video](https://developer.android.com/jetpack/androidx/releases/camera) [View Source](https://cs.android.com/search?q=file:androidx/camera/video/Recorder.java+class:androidx.camera.video.Recorder) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/camera#1.1.0)

*** ** * ** ***


```
public final class Recorder implements VideoOutput
```

<br />

*** ** * ** ***

An implementation of `https://developer.android.com/reference/androidx/camera/video/VideoOutput` for starting video recordings that are saved to a `https://developer.android.com/reference/java/io/File.html`, `https://developer.android.com/reference/android/os/ParcelFileDescriptor.html`, or `https://developer.android.com/reference/android/provider/MediaStore.html`.

A recorder can be used to save the video frames sent from the `https://developer.android.com/reference/androidx/camera/video/VideoCapture` use case in common recording formats such as MPEG4.

Usage example of setting up `https://developer.android.com/reference/androidx/camera/video/VideoCapture` with a recorder as output:

```
ProcessCameraProvider cameraProvider = ...;
CameraSelector cameraSelector = ...;
...
// Create our preview to show on screen
Preview preview = new Preview.Builder.build();
// Create the video capture use case with a Recorder as the output
VideoCapturevideoCapture = VideoCapture.withOutput(new Recorder.Builder().build());

// Bind use cases to Fragment/Activity lifecycle
cameraProvider.bindToLifecycle(this, cameraSelector, preview, videoCapture);
```

Once the recorder is attached to a video source as a `https://developer.android.com/reference/androidx/camera/video/VideoOutput`, e.g. using it to create a `https://developer.android.com/reference/androidx/camera/video/VideoCapture` by calling `https://developer.android.com/reference/androidx/camera/video/VideoCapture#withOutput(T)`, a new recording can be generated with one of the prepareRecording methods, such as `https://developer.android.com/reference/androidx/camera/video/Recorder#prepareRecording(android.content.Context,androidx.camera.video.MediaStoreOutputOptions)`. The `https://developer.android.com/reference/androidx/camera/video/PendingRecording` class then can be used to adjust per-recording settings and to start the recording. It also requires passing a listener to `https://developer.android.com/reference/androidx/camera/video/PendingRecording#start(java.util.concurrent.Executor,androidx.core.util.Consumer<androidx.camera.video.VideoRecordEvent>)` to listen for `https://developer.android.com/reference/androidx/camera/video/VideoRecordEvent`s such as `https://developer.android.com/reference/androidx/camera/video/VideoRecordEvent.Start`, `https://developer.android.com/reference/androidx/camera/video/VideoRecordEvent.Pause`, `https://developer.android.com/reference/androidx/camera/video/VideoRecordEvent.Resume`, and `https://developer.android.com/reference/androidx/camera/video/VideoRecordEvent.Finalize`. This listener will also receive regular recording status updates via the `https://developer.android.com/reference/androidx/camera/video/VideoRecordEvent.Status` event.

Attaching a single Recorder instance to multiple video sources at the same time may causes unexpected behaviors and is not recommended.

A recorder can also capture and save audio alongside video. The audio must be explicitly enabled with `https://developer.android.com/reference/androidx/camera/video/PendingRecording#withAudioEnabled()` before starting the recording.

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/camera/video/VideoCapture#withOutput(T)` |   |
| `https://developer.android.com/reference/androidx/camera/video/PendingRecording` |   |

## Summary

| ### Nested types |
|---|
| `public final class https://developer.android.com/reference/androidx/camera/video/Recorder.Builder` Builder class for `https://developer.android.com/reference/androidx/camera/video/Recorder` objects. |

| ### Constants |
|---|---|
| `static final https://developer.android.com/reference/androidx/camera/video/QualitySelector` | `https://developer.android.com/reference/androidx/camera/video/Recorder#DEFAULT_QUALITY_SELECTOR()` Default quality selector for recordings. |
| `static final int` | `https://developer.android.com/reference/androidx/camera/video/Recorder#VIDEO_CAPABILITIES_SOURCE_CAMCORDER_PROFILE() = 0` Video capabilities are derived from `https://developer.android.com/reference/android/media/CamcorderProfile.html`. |
| `static final int` | `https://developer.android.com/reference/androidx/camera/video/Recorder#VIDEO_CAPABILITIES_SOURCE_CODEC_CAPABILITIES() = 1` Video capabilities are derived from codec capabilities. |

| ### Public methods |
|---|---|
| `int` | `https://developer.android.com/reference/androidx/camera/video/Recorder#getAspectRatio()()` Gets the aspect ratio of this Recorder. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/camera/video/Recorder#getAudioMimeType()()` Gets the audio MIME type of this Recorder. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/util/concurrent/Executor.html` | `https://developer.android.com/reference/androidx/camera/video/Recorder#getExecutor()()` Returns the executor provided to the builder for this recorder. |
| `static @https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/camera/video/VideoCapabilities` | `https://developer.android.com/reference/androidx/camera/video/Recorder#getHighSpeedVideoCapabilities(androidx.camera.core.CameraInfo)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/camera/core/CameraInfo cameraInfo)` Returns the high-speed `https://developer.android.com/reference/androidx/camera/video/VideoCapabilities` of Recorder with respect to input camera information. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/camera/video/QualitySelector` | `https://developer.android.com/reference/androidx/camera/video/Recorder#getQualitySelector()()` Gets the quality selector of this Recorder. |
| `static @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/java/lang/String.html>` | `@https://developer.android.com/reference/androidx/camera/video/ExperimentalMimeTypeApi https://developer.android.com/reference/androidx/camera/video/Recorder#getSupportedAudioMimeTypes()()` Returns the audio MIME types supported by the device that are compatible with Recorder. |
| `static @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/java/lang/String.html>` | `@https://developer.android.com/reference/androidx/camera/video/ExperimentalMimeTypeApi https://developer.android.com/reference/androidx/camera/video/Recorder#getSupportedVideoMimeTypes()()` Returns the video MIME types supported by the device that are compatible with Recorder. |
| `@https://developer.android.com/reference/androidx/annotation/IntRange(from = 0) int` | `https://developer.android.com/reference/androidx/camera/video/Recorder#getTargetAudioChannelCount()()` Returns the target audio channel count of this Recorder. |
| `@https://developer.android.com/reference/androidx/annotation/IntRange(from = 0) int` | `https://developer.android.com/reference/androidx/camera/video/Recorder#getTargetAudioEncodingBitRate()()` Gets the target audio encoding bitrate of this Recorder. |
| `@https://developer.android.com/reference/androidx/annotation/IntRange(from = 0) int` | `https://developer.android.com/reference/androidx/camera/video/Recorder#getTargetVideoEncodingBitRate()()` Gets the target video encoding bitrate of this Recorder. |
| `static @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/camera/video/VideoCapabilities` | `https://developer.android.com/reference/androidx/camera/video/Recorder#getVideoCapabilities(androidx.camera.core.CameraInfo)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/camera/core/CameraInfo cameraInfo)` Returns the `https://developer.android.com/reference/androidx/camera/video/VideoCapabilities` of Recorder with respect to input camera information. |
| `static @https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/camera/video/VideoCapabilities` | `https://developer.android.com/reference/androidx/camera/video/Recorder#getVideoCapabilities(androidx.camera.core.CameraInfo,java.lang.String)( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/camera/core/CameraInfo cameraInfo, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html mimeType )` Returns the `https://developer.android.com/reference/androidx/camera/video/VideoCapabilities` of Recorder with respect to input camera information and video MIME type. |
| `static @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/camera/video/VideoCapabilities` | `https://developer.android.com/reference/androidx/camera/video/Recorder#getVideoCapabilities(androidx.camera.core.CameraInfo,int)( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/camera/core/CameraInfo cameraInfo, int videoCapabilitiesSource )` Returns the `https://developer.android.com/reference/androidx/camera/video/VideoCapabilities` of Recorder with respect to input camera information and video capabilities source. |
| `int` | `https://developer.android.com/reference/androidx/camera/video/Recorder#getVideoCapabilitiesSource()()` Gets the video capabilities source of this Recorder. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/camera/video/Recorder#getVideoMimeType()()` Gets the video MIME type of this Recorder. |
| `void` | `https://developer.android.com/reference/androidx/camera/video/Recorder#onSurfaceRequested(androidx.camera.core.SurfaceRequest)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/camera/core/SurfaceRequest request)` Called when a new `https://developer.android.com/reference/android/view/Surface.html` has been requested by a video frame producer. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/camera/video/PendingRecording` | `@https://developer.android.com/reference/androidx/annotation/RequiresApi(value = 26) https://developer.android.com/reference/androidx/camera/video/Recorder#prepareRecording(android.content.Context,androidx.camera.video.FileDescriptorOutputOptions)( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/content/Context.html context, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/camera/video/FileDescriptorOutputOptions fileDescriptorOutputOptions )` Prepares a recording that will be saved to a `https://developer.android.com/reference/android/os/ParcelFileDescriptor.html`. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/camera/video/PendingRecording` | `https://developer.android.com/reference/androidx/camera/video/Recorder#prepareRecording(android.content.Context,androidx.camera.video.FileOutputOptions)( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/content/Context.html context, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/camera/video/FileOutputOptions fileOutputOptions )` Prepares a recording that will be saved to a `https://developer.android.com/reference/java/io/File.html`. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/camera/video/PendingRecording` | `https://developer.android.com/reference/androidx/camera/video/Recorder#prepareRecording(android.content.Context,androidx.camera.video.MediaStoreOutputOptions)( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/content/Context.html context, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/camera/video/MediaStoreOutputOptions mediaStoreOutputOptions )` Prepares a recording that will be saved to a `https://developer.android.com/reference/android/provider/MediaStore.html`. |

## Constants

### DEFAULT_QUALITY_SELECTOR

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/camera#1.1.0)

```
public static final QualitySelector DEFAULT_QUALITY_SELECTOR
```

Default quality selector for recordings.

The default quality selector chooses a video quality suitable for recordings based on device and compatibility constraints. It is equivalent to:

```
QualitySelector.fromOrderedList(Arrays.asList(Quality.FHD, Quality.HD, Quality.SD),
        FallbackStrategy.higherQualityOrLowerThan(Quality.FHD));
```

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/camera/video/QualitySelector` |   |

### VIDEO_CAPABILITIES_SOURCE_CAMCORDER_PROFILE

Added in [1.4.0](https://developer.android.com/jetpack/androidx/releases/camera#1.4.0)

```
public static final int VIDEO_CAPABILITIES_SOURCE_CAMCORDER_PROFILE = 0
```

Video capabilities are derived from `https://developer.android.com/reference/android/media/CamcorderProfile.html`.

The `https://developer.android.com/reference/androidx/camera/video/Quality` supported by the video capabilities of this source are determined by the device's `https://developer.android.com/reference/android/media/CamcorderProfile.html`. This means that the quality of recorded videos is guaranteed by the device manufacturer. This is the recommended type for recording high-quality video.

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/camera/video/Recorder.Builder#setVideoCapabilitiesSource(int)` |   |

### VIDEO_CAPABILITIES_SOURCE_CODEC_CAPABILITIES

Added in [1.4.0](https://developer.android.com/jetpack/androidx/releases/camera#1.4.0)

```
public static final int VIDEO_CAPABILITIES_SOURCE_CODEC_CAPABILITIES = 1
```

Video capabilities are derived from codec capabilities.

The `https://developer.android.com/reference/androidx/camera/video/Quality` supported by the video capabilities of this source are determined by the codec capabilities. However, the recorded videos is not guaranteed. For example, there may be frame drops due to thermal throttling or memory pressure. Therefore, it is recommended to use `https://developer.android.com/reference/androidx/camera/video/Recorder#VIDEO_CAPABILITIES_SOURCE_CAMCORDER_PROFILE()` unless there is a specific reason. A common use case is when the application strives to record UHD video whenever feasible, but the device's `https://developer.android.com/reference/android/media/CamcorderProfile.html` does not include a UHD quality setting, even though the codec is capable of recording UHD video.

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/camera/video/Recorder.Builder#setVideoCapabilitiesSource(int)` |   |

## Public methods

### getAspectRatio

Added in [1.3.0](https://developer.android.com/jetpack/androidx/releases/camera#1.3.0)

```
public int getAspectRatio()
```

Gets the aspect ratio of this Recorder.

| Returns |
|---|---|
| `int` | the value from `https://developer.android.com/reference/androidx/camera/video/Recorder.Builder#setAspectRatio(int)` or `https://developer.android.com/reference/androidx/camera/core/AspectRatio#RATIO_DEFAULT()` if not set. |

### getAudioMimeType

Added in [1.7.0-rc02](https://developer.android.com/jetpack/androidx/releases/camera#1.7.0-rc02)

```
public @NonNull String getAudioMimeType()
```

Gets the audio MIME type of this Recorder.

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html` | the audio MIME type provided to `https://developer.android.com/reference/androidx/camera/video/Recorder.Builder#setAudioMimeType(java.lang.String)`. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/camera/video/Recorder.Builder#setAudioMimeType(java.lang.String)` |   |

### getExecutor

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/camera#1.1.0)

```
public @Nullable Executor getExecutor()
```

Returns the executor provided to the builder for this recorder.

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/util/concurrent/Executor.html` | the `https://developer.android.com/reference/java/util/concurrent/Executor.html` provided to `https://developer.android.com/reference/androidx/camera/video/Recorder.Builder#setExecutor(java.util.concurrent.Executor)` on the builder used to create this recorder. If no executor was provided, returns {code null}. |

### getHighSpeedVideoCapabilities

Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/camera#1.5.0)

```
public static @Nullable VideoCapabilities getHighSpeedVideoCapabilities(@NonNull CameraInfo cameraInfo)
```

Returns the high-speed `https://developer.android.com/reference/androidx/camera/video/VideoCapabilities` of Recorder with respect to input camera information.

The returned `https://developer.android.com/reference/androidx/camera/video/VideoCapabilities` provides methods to query supported dynamic ranges, qualities for high-speed video. For recording high-speed and slow-motion videos, refer to `https://developer.android.com/reference/androidx/camera/video/HighSpeedVideoSessionConfig`.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/camera/core/CameraInfo cameraInfo` | info about the camera. |

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/camera/video/VideoCapabilities` | high-speed VideoCapabilities with respect to the input camera info, or null if high-speed video is not supported. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/camera/video/HighSpeedVideoSessionConfig` |   |

### getQualitySelector

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/camera#1.1.0)

```
public @NonNull QualitySelector getQualitySelector()
```

Gets the quality selector of this Recorder.

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/camera/video/QualitySelector` | the `https://developer.android.com/reference/androidx/camera/video/QualitySelector` provided to `https://developer.android.com/reference/androidx/camera/video/Recorder.Builder#setQualitySelector(androidx.camera.video.QualitySelector)` on the builder used to create this recorder, or the default value of `https://developer.android.com/reference/androidx/camera/video/Recorder#DEFAULT_QUALITY_SELECTOR()` if no quality selector was provided. |

### getSupportedAudioMimeTypes

Added in [1.7.0-rc02](https://developer.android.com/jetpack/androidx/releases/camera#1.7.0-rc02)

```
@ExperimentalMimeTypeApi
public static @NonNull List<String> getSupportedAudioMimeTypes()
```

Returns the audio MIME types supported by the device that are compatible with Recorder.

The returned list contains only those MIME types that are supported by the device's encoders and are compatible with Recorder. This list is a subset of the formats accepted by `https://developer.android.com/reference/androidx/camera/video/Recorder.Builder#setAudioMimeType(java.lang.String)`.

This method should be used to discover available formats at runtime. Once a MIME type is selected from this list, it can be passed to `https://developer.android.com/reference/androidx/camera/video/Recorder.Builder#setAudioMimeType(java.lang.String)` to configure the recorder.

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/java/lang/String.html>` | A list of strings representing the supported audio MIME types. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/camera/video/Recorder.Builder#setAudioMimeType(java.lang.String)` |   |

### getSupportedVideoMimeTypes

Added in [1.7.0-rc02](https://developer.android.com/jetpack/androidx/releases/camera#1.7.0-rc02)

```
@ExperimentalMimeTypeApi
public static @NonNull List<String> getSupportedVideoMimeTypes()
```

Returns the video MIME types supported by the device that are compatible with Recorder.

The returned list contains only those MIME types that are supported by the device's encoders and are compatible with Recorder. This list is a subset of the formats accepted by `https://developer.android.com/reference/androidx/camera/video/Recorder.Builder#setVideoMimeType(java.lang.String)`.

This method should be used to discover available formats at runtime. Once a MIME type is selected from this list, it can be passed to `https://developer.android.com/reference/androidx/camera/video/Recorder.Builder#setVideoMimeType(java.lang.String)` to configure the recorder. To query specific camera-dependent capabilities for a chosen MIME type, such as supported qualities or dynamic ranges, use `https://developer.android.com/reference/androidx/camera/video/Recorder#getVideoCapabilities(androidx.camera.core.CameraInfo,java.lang.String)`.

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/java/lang/String.html>` | A list of strings representing the supported video MIME types. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/camera/video/Recorder.Builder#setVideoMimeType(java.lang.String)` |   |
| `https://developer.android.com/reference/androidx/camera/video/Recorder#getVideoCapabilities(androidx.camera.core.CameraInfo,java.lang.String)` |   |

### getTargetAudioChannelCount

Added in [1.7.0-rc02](https://developer.android.com/jetpack/androidx/releases/camera#1.7.0-rc02)

```
public @IntRange(from = 0) int getTargetAudioChannelCount()
```

Returns the target audio channel count of this Recorder.

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/IntRange(from = 0) int` | the value provided to `https://developer.android.com/reference/androidx/camera/video/Recorder.Builder#setTargetAudioChannelCount(int)` on the builder used to create this recorder. Returns 0 if `https://developer.android.com/reference/androidx/camera/video/Recorder.Builder#setTargetAudioChannelCount(int)` is not called. |

### getTargetAudioEncodingBitRate

Added in [1.7.0-rc02](https://developer.android.com/jetpack/androidx/releases/camera#1.7.0-rc02)

```
public @IntRange(from = 0) int getTargetAudioEncodingBitRate()
```

Gets the target audio encoding bitrate of this Recorder.

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/IntRange(from = 0) int` | the value provided to `https://developer.android.com/reference/androidx/camera/video/Recorder.Builder#setTargetAudioEncodingBitRate(int)` on the builder used to create this recorder. Returns 0, if `https://developer.android.com/reference/androidx/camera/video/Recorder.Builder#setTargetAudioEncodingBitRate(int)` is not called. |

### getTargetVideoEncodingBitRate

Added in [1.3.0](https://developer.android.com/jetpack/androidx/releases/camera#1.3.0)

```
public @IntRange(from = 0) int getTargetVideoEncodingBitRate()
```

Gets the target video encoding bitrate of this Recorder.

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/IntRange(from = 0) int` | the value provided to `https://developer.android.com/reference/androidx/camera/video/Recorder.Builder#setTargetVideoEncodingBitRate(int)` on the builder used to create this recorder. Returns 0, if `https://developer.android.com/reference/androidx/camera/video/Recorder.Builder#setTargetVideoEncodingBitRate(int)` is not called. |

### getVideoCapabilities

Added in [1.3.0](https://developer.android.com/jetpack/androidx/releases/camera#1.3.0)

```
public static @NonNull VideoCapabilities getVideoCapabilities(@NonNull CameraInfo cameraInfo)
```

Returns the `https://developer.android.com/reference/androidx/camera/video/VideoCapabilities` of Recorder with respect to input camera information.

`https://developer.android.com/reference/androidx/camera/video/VideoCapabilities` provides methods to query supported dynamic ranges and qualities. This information can be used for things like checking if HDR is supported for configuring VideoCapture to record HDR video.

The source of the returned `https://developer.android.com/reference/androidx/camera/video/VideoCapabilities` is `https://developer.android.com/reference/androidx/camera/video/Recorder#VIDEO_CAPABILITIES_SOURCE_CAMCORDER_PROFILE()`. To get a `https://developer.android.com/reference/androidx/camera/video/VideoCapabilities` from a different source, use `https://developer.android.com/reference/androidx/camera/video/Recorder#getVideoCapabilities(androidx.camera.core.CameraInfo,int)`.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/camera/core/CameraInfo cameraInfo` | info about the camera. |

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/camera/video/VideoCapabilities` | VideoCapabilities with respect to the input camera info. |

### getVideoCapabilities

Added in [1.7.0-rc02](https://developer.android.com/jetpack/androidx/releases/camera#1.7.0-rc02)

```
public static @Nullable VideoCapabilities getVideoCapabilities(
    @NonNull CameraInfo cameraInfo,
    @NonNull String mimeType
)
```

Returns the `https://developer.android.com/reference/androidx/camera/video/VideoCapabilities` of Recorder with respect to input camera information and video MIME type.

`https://developer.android.com/reference/androidx/camera/video/VideoCapabilities` provides methods to query supported dynamic ranges and qualities. This information can be used for things like checking if HDR is supported for configuring VideoCapture to record HDR video.

This method provides an aggregated view of the combined capabilities of the selected camera and the device's video encoder for the specified format. It allows discovery of supported qualities, dynamic ranges, and other constraints associated with a specific encoding format without the need to manually cross-reference camera and encoder capabilities.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/camera/core/CameraInfo cameraInfo` | info about the camera. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html mimeType` | the video MIME type to query capabilities for (e.g., "video/hevc"). |

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/camera/video/VideoCapabilities` | VideoCapabilities with respect to the input camera info and video MIME type, or `null` if no capabilities are found for the given MIME type. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/camera/video/Recorder#getSupportedVideoMimeTypes()` |   |
| `https://developer.android.com/reference/androidx/camera/video/Recorder.Builder#setVideoMimeType(java.lang.String)` |   |

### getVideoCapabilities

Added in [1.4.0](https://developer.android.com/jetpack/androidx/releases/camera#1.4.0)

```
public static @NonNull VideoCapabilities getVideoCapabilities(
    @NonNull CameraInfo cameraInfo,
    int videoCapabilitiesSource
)
```

Returns the `https://developer.android.com/reference/androidx/camera/video/VideoCapabilities` of Recorder with respect to input camera information and video capabilities source.

`https://developer.android.com/reference/androidx/camera/video/VideoCapabilities` provides methods to query supported dynamic ranges and qualities. This information can be used for things like checking if HDR is supported for configuring VideoCapture to record HDR video.

The possible video capabilities sources include `https://developer.android.com/reference/androidx/camera/video/Recorder#VIDEO_CAPABILITIES_SOURCE_CAMCORDER_PROFILE()` and `https://developer.android.com/reference/androidx/camera/video/Recorder#VIDEO_CAPABILITIES_SOURCE_CODEC_CAPABILITIES()`.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/camera/core/CameraInfo cameraInfo` | info about the camera. |
| `int videoCapabilitiesSource` | the video capabilities source. |

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/camera/video/VideoCapabilities` | VideoCapabilities with respect to the input camera info and video capabilities source. |

### getVideoCapabilitiesSource

Added in [1.4.0](https://developer.android.com/jetpack/androidx/releases/camera#1.4.0)

```
public int getVideoCapabilitiesSource()
```

Gets the video capabilities source of this Recorder.

| Returns |
|---|---|
| `int` | the value provided to `https://developer.android.com/reference/androidx/camera/video/Recorder.Builder#setVideoCapabilitiesSource(int)` on the builder used to create this recorder, or the default value `https://developer.android.com/reference/androidx/camera/video/Recorder#VIDEO_CAPABILITIES_SOURCE_CAMCORDER_PROFILE()` if not set. |

### getVideoMimeType

Added in [1.7.0-rc02](https://developer.android.com/jetpack/androidx/releases/camera#1.7.0-rc02)

```
public @NonNull String getVideoMimeType()
```

Gets the video MIME type of this Recorder.

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html` | the video MIME type provided to `https://developer.android.com/reference/androidx/camera/video/Recorder.Builder#setVideoMimeType(java.lang.String)`. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/camera/video/Recorder.Builder#setVideoMimeType(java.lang.String)` |   |

### onSurfaceRequested

```
public void onSurfaceRequested(@NonNull SurfaceRequest request)
```

Called when a new `https://developer.android.com/reference/android/view/Surface.html` has been requested by a video frame producer.

Users of this class should not call this method directly. It will be called by the video frame producer. Implementors of this class should be aware that this method is called when a video frame producer is ready to receive a surface that it can use to send video frames to the video output. The video frame producer may repeatedly request a surface more than once, but only the latest `https://developer.android.com/reference/androidx/camera/core/SurfaceRequest` should be considered active. All previous surface requests will complete by sending a `https://developer.android.com/reference/androidx/camera/core/SurfaceRequest.Result` to the consumer passed to `https://developer.android.com/reference/androidx/camera/core/SurfaceRequest#provideSurface(android.view.Surface,java.util.concurrent.Executor,androidx.core.util.Consumer<androidx.camera.core.SurfaceRequest.Result>)`.

A request is considered active until it is `https://developer.android.com/reference/androidx/camera/core/SurfaceRequest#provideSurface(android.view.Surface,java.util.concurrent.Executor,androidx.core.util.Consumer<androidx.camera.core.SurfaceRequest.Result>)`, `https://developer.android.com/reference/androidx/camera/core/SurfaceRequest#willNotProvideSurface()`, or `https://developer.android.com/reference/androidx/camera/core/SurfaceRequest#addRequestCancellationListener(java.util.concurrent.Executor,java.lang.Runnable)`. After one of these conditions occurs, a request is considered completed.

Once a request is successfully completed, it is guaranteed that if a new request is made, the `https://developer.android.com/reference/android/view/Surface.html` used to fulfill the previous request will be detached from the video frame producer and the `resultListener` provided in `https://developer.android.com/reference/androidx/camera/core/SurfaceRequest#provideSurface(android.view.Surface,java.util.concurrent.Executor,androidx.core.util.Consumer<androidx.camera.core.SurfaceRequest.Result>)` will be invoked with a `https://developer.android.com/reference/androidx/camera/core/SurfaceRequest.Result` containing `https://developer.android.com/reference/androidx/camera/core/SurfaceRequest.Result#RESULT_SURFACE_USED_SUCCESSFULLY()`.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/camera/core/SurfaceRequest request` | the request for a surface which contains the requirements of the surface and methods for completing the request. |

### prepareRecording

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/camera#1.1.0)

```
@RequiresApi(value = 26)
public @NonNull PendingRecording prepareRecording(
    @NonNull Context context,
    @NonNull FileDescriptorOutputOptions fileDescriptorOutputOptions
)
```

Prepares a recording that will be saved to a `https://developer.android.com/reference/android/os/ParcelFileDescriptor.html`.

The provided `https://developer.android.com/reference/androidx/camera/video/FileDescriptorOutputOptions` specifies the `https://developer.android.com/reference/android/os/ParcelFileDescriptor.html` to use.

Currently, file descriptors as output destinations are not supported on pre-Android O (API 26) devices.

Calling this method multiple times will generate multiple `https://developer.android.com/reference/androidx/camera/video/PendingRecording`s, each of the recordings can be used to adjust per-recording settings individually. The recording will not begin until `https://developer.android.com/reference/androidx/camera/video/PendingRecording#start(java.util.concurrent.Executor,androidx.core.util.Consumer<androidx.camera.video.VideoRecordEvent>)` is called. Only a single pending recording can be started per `https://developer.android.com/reference/androidx/camera/video/Recorder` instance.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/content/Context.html context` | the context used to enforce runtime permissions, interface with the media scanner service, and attribute access to permission protected data, such as audio. If using this context to [audit audio access](https://developer.android.com/guide /topics/data/audit-access#audit-by-attribution-tagaudit) on API level 31+, a context created with `https://developer.android.com/reference/android/content/Context.html#createAttributionContext(java.lang.String)` should be used. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/camera/video/FileDescriptorOutputOptions fileDescriptorOutputOptions` | the options that configures how the output will be handled. |

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/camera/video/PendingRecording` | a `https://developer.android.com/reference/androidx/camera/video/PendingRecording` that is associated with this Recorder. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/UnsupportedOperationException.html` | if this method is called on per-Android O (API 26) devices. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/camera/video/FileDescriptorOutputOptions` |   |

### prepareRecording

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/camera#1.1.0)

```
public @NonNull PendingRecording prepareRecording(
    @NonNull Context context,
    @NonNull FileOutputOptions fileOutputOptions
)
```

Prepares a recording that will be saved to a `https://developer.android.com/reference/java/io/File.html`.

The provided `https://developer.android.com/reference/androidx/camera/video/FileOutputOptions` specifies the file to use.

Calling this method multiple times will generate multiple `https://developer.android.com/reference/androidx/camera/video/PendingRecording`s, each of the recordings can be used to adjust per-recording settings individually. The recording will not begin until `https://developer.android.com/reference/androidx/camera/video/PendingRecording#start(java.util.concurrent.Executor,androidx.core.util.Consumer<androidx.camera.video.VideoRecordEvent>)` is called. Only a single pending recording can be started per `https://developer.android.com/reference/androidx/camera/video/Recorder` instance.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/content/Context.html context` | the context used to enforce runtime permissions, interface with the media scanner service, and attribute access to permission protected data, such as audio. If using this context to [audit audio access](https://developer.android.com/guide /topics/data/audit-access#audit-by-attribution-tagaudit) on API level 31+, a context created with `https://developer.android.com/reference/android/content/Context.html#createAttributionContext(java.lang.String)` should be used. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/camera/video/FileOutputOptions fileOutputOptions` | the options that configures how the output will be handled. |

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/camera/video/PendingRecording` | a `https://developer.android.com/reference/androidx/camera/video/PendingRecording` that is associated with this Recorder. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/camera/video/FileOutputOptions` |   |

### prepareRecording

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/camera#1.1.0)

```
public @NonNull PendingRecording prepareRecording(
    @NonNull Context context,
    @NonNull MediaStoreOutputOptions mediaStoreOutputOptions
)
```

Prepares a recording that will be saved to a `https://developer.android.com/reference/android/provider/MediaStore.html`.

The provided `https://developer.android.com/reference/androidx/camera/video/MediaStoreOutputOptions` specifies the options which will be used to save the recording to a `https://developer.android.com/reference/android/provider/MediaStore.html`.

Calling this method multiple times will generate multiple `https://developer.android.com/reference/androidx/camera/video/PendingRecording`s, each of the recordings can be used to adjust per-recording settings individually. The recording will not begin until `https://developer.android.com/reference/androidx/camera/video/PendingRecording#start(java.util.concurrent.Executor,androidx.core.util.Consumer<androidx.camera.video.VideoRecordEvent>)` is called. Only a single pending recording can be started per `https://developer.android.com/reference/androidx/camera/video/Recorder` instance.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/content/Context.html context` | the context used to enforce runtime permissions, interface with the media scanner service, and attribute access to permission protected data, such as audio. If using this context to [audit audio access](https://developer.android.com/guide /topics/data/audit-access#audit-by-attribution-tagaudit) on API level 31+, a context created with `https://developer.android.com/reference/android/content/Context.html#createAttributionContext(java.lang.String)` should be used. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/camera/video/MediaStoreOutputOptions mediaStoreOutputOptions` | the options that configures how the output will be handled. |

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/camera/video/PendingRecording` | a `https://developer.android.com/reference/androidx/camera/video/PendingRecording` that is associated with this Recorder. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/camera/video/MediaStoreOutputOptions` |   |