# FileDescriptorOutputOptions.Builder

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/FileDescriptorOutputOptions.java+class:androidx.camera.video.FileDescriptorOutputOptions.Builder) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/camera#1.1.0)

*** ** * ** ***


```
public final class FileDescriptorOutputOptions.Builder
```

<br />

*** ** * ** ***

The builder of the `https://developer.android.com/reference/androidx/camera/video/FileDescriptorOutputOptions` object.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/camera/video/FileDescriptorOutputOptions.Builder#Builder(android.os.ParcelFileDescriptor)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/os/ParcelFileDescriptor.html fileDescriptor)` Creates a builder of the `https://developer.android.com/reference/androidx/camera/video/FileDescriptorOutputOptions` with a file descriptor. |

| ### Public methods |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/camera/video/FileDescriptorOutputOptions` | `https://developer.android.com/reference/androidx/camera/video/FileDescriptorOutputOptions.Builder#build()()` Builds the `https://developer.android.com/reference/androidx/camera/video/FileDescriptorOutputOptions` instance. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html B` | `https://developer.android.com/reference/androidx/camera/video/FileDescriptorOutputOptions.Builder#setDurationLimitMillis(long)(@https://developer.android.com/reference/androidx/annotation/IntRange(from = 0) long durationLimitMillis)` Sets the limit for the video duration in milliseconds. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html B` | `https://developer.android.com/reference/androidx/camera/video/FileDescriptorOutputOptions.Builder#setFileSizeLimit(long)(@https://developer.android.com/reference/androidx/annotation/IntRange(from = 0) long fileSizeLimitBytes)` Sets the limit for the file length in bytes. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html B` | `https://developer.android.com/reference/androidx/camera/video/FileDescriptorOutputOptions.Builder#setLocation(android.location.Location)(@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/location/Location.html location)` Sets a `https://developer.android.com/reference/android/location/Location.html` object representing a geographic location where the video was recorded. |

## Public constructors

### Builder

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

```
public Builder(@NonNull ParcelFileDescriptor fileDescriptor)
```

Creates a builder of the `https://developer.android.com/reference/androidx/camera/video/FileDescriptorOutputOptions` with a file descriptor.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/os/ParcelFileDescriptor.html fileDescriptor` | the file descriptor to use as the output destination. |

## Public methods

### build

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

```
public @NonNull FileDescriptorOutputOptions build()
```

Builds the `https://developer.android.com/reference/androidx/camera/video/FileDescriptorOutputOptions` instance.

### setDurationLimitMillis

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

```
public @NonNull B setDurationLimitMillis(@IntRange(from = 0) long durationLimitMillis)
```

Sets the limit for the video duration in milliseconds.

When used to generate recording with `https://developer.android.com/reference/androidx/camera/video/Recorder`, if the specified duration limit is reached while the recording is being recorded, the recording will be finalized with `https://developer.android.com/reference/androidx/camera/video/VideoRecordEvent.Finalize#ERROR_DURATION_LIMIT_REACHED()`.

If not set or set with zero, the duration will be `https://developer.android.com/reference/androidx/camera/video/OutputOptions#DURATION_UNLIMITED()`. If set with a negative value, an `https://developer.android.com/reference/java/lang/IllegalArgumentException.html` will be thrown.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/IntRange(from = 0) long durationLimitMillis` | the video duration limit in milliseconds. |

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html B` | this Builder. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException.html` | if the specified duration limit is negative. |

### setFileSizeLimit

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

```
public @NonNull B setFileSizeLimit(@IntRange(from = 0) long fileSizeLimitBytes)
```

Sets the limit for the file length in bytes.

When used with `https://developer.android.com/reference/androidx/camera/video/Recorder` to generate recording, if the specified file size limit is reached while the recording is being recorded, the recording will be finalized with `https://developer.android.com/reference/androidx/camera/video/VideoRecordEvent.Finalize#ERROR_FILE_SIZE_LIMIT_REACHED()`.

If not set or set with zero, the file size will be `https://developer.android.com/reference/androidx/camera/video/OutputOptions#FILE_SIZE_UNLIMITED()`. If set with a negative value, an `https://developer.android.com/reference/java/lang/IllegalArgumentException.html` will be thrown.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/IntRange(from = 0) long fileSizeLimitBytes` | the file size limit in bytes. |

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html B` | this Builder. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException.html` | if the specified file size limit is negative. |

### setLocation

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

```
public @NonNull B setLocation(@Nullable Location location)
```

Sets a `https://developer.android.com/reference/android/location/Location.html` object representing a geographic location where the video was recorded.

When used with `https://developer.android.com/reference/androidx/camera/video/Recorder`, only the latitude and longitude from the `https://developer.android.com/reference/android/location/Location.html` are stored in the udta box if the output format is MP4, and are ignored for other formats. Other location data (such as altitude) is not stored. The geographic location is stored according to the ISO-6709 standard.

If `null`, no location information will be saved with the video. Default value is `null`.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/location/Location.html location` | the location object, or `null` if no location should be saved. |

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html B` | this Builder. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException.html` | if the latitude of the location is not in the range `[-90, 90]` or the longitude of the location is not in the range `[-180, 180]`. |