Package com.google.android.exoplayer2.transformer

## Class DefaultEncoderFactory.Builder

- java.lang.Object
- - com.google.android.exoplayer2.transformer.DefaultEncoderFactory.Builder

- Enclosing class:
    DefaultEncoderFactory

      public static final class DefaultEncoderFactory.Builder
      extends Object

  A builder for `DefaultEncoderFactory` instances.

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `Builder​(Context context)` | Creates a new `DefaultEncoderFactory.Builder`.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `DefaultEncoderFactory` | `build()` | Creates an instance of `DefaultEncoderFactory`, using defaults if values are unset.
    `DefaultEncoderFactory.Builder` | `setEnableFallback​(boolean enableFallback)` | Sets whether the encoder can fallback.
    `DefaultEncoderFactory.Builder` | `setRequestedVideoEncoderSettings​(VideoEncoderSettings requestedVideoEncoderSettings)` | Sets the requested `VideoEncoderSettings`.
    `DefaultEncoderFactory.Builder` | `setVideoEncoderSelector​(EncoderSelector encoderSelector)` | Sets the video `EncoderSelector`.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### Builder

          public Builder​(Context context)

      Creates a new `DefaultEncoderFactory.Builder`.

  - ### Method Detail

    - #### setVideoEncoderSelector

          @CanIgnoreReturnValue
          public DefaultEncoderFactory.Builder setVideoEncoderSelector​(EncoderSelector encoderSelector)

      Sets the video `EncoderSelector`.

      The default value is `EncoderSelector.DEFAULT`.

    - #### setRequestedVideoEncoderSettings

          @CanIgnoreReturnValue
          public DefaultEncoderFactory.Builder setRequestedVideoEncoderSettings​(VideoEncoderSettings requestedVideoEncoderSettings)

      Sets the requested `VideoEncoderSettings`.

      Values in `requestedVideoEncoderSettings` may be ignored to improve encoding quality and/or reduce failures.

      `VideoEncoderSettings.profile` and `VideoEncoderSettings.level` are ignored for `MimeTypes.VIDEO_H264`. Consider implementing `Codec.EncoderFactory` if such adjustments are unwanted.

      `requestedVideoEncoderSettings` should be handled with care because there is no fallback support for it. For example, using incompatible `VideoEncoderSettings.profile` and `VideoEncoderSettings.level` can cause codec configuration failure. Setting an unsupported `VideoEncoderSettings.bitrateMode` may cause encoder instantiation failure.

      The default value is `VideoEncoderSettings.DEFAULT`.

    - #### setEnableFallback

          @CanIgnoreReturnValue
          public DefaultEncoderFactory.Builder setEnableFallback​(boolean enableFallback)

      Sets whether the encoder can fallback.

      With format fallback enabled, when the requested `Format` is not supported, `DefaultEncoderFactory` finds a format that is supported by the device and configures the `Codec` with it. The fallback process may change the requested `MIME type`, resolution, `bitrate`, `profile/level` etc.

      The default value is `true`.

    - #### build

          public DefaultEncoderFactory build()

      Creates an instance of `DefaultEncoderFactory`, using defaults if values are unset.