# GlEffect

Artifact: [androidx.media3:media3-effect](https://developer.android.com/jetpack/androidx/releases/media3) [View Source](https://cs.android.com/search?q=file:androidx/media3/effect/GlEffect.java+class:androidx.media3.effect.GlEffect)

*** ** * ** ***


```
@UnstableApi
public interface GlEffect extends Effect
```

<br />

Known direct subclasses [AlphaScale](https://developer.android.com/reference/androidx/media3/effect/AlphaScale), [ByteBufferGlEffect](https://developer.android.com/reference/androidx/media3/effect/ByteBufferGlEffect), [ColorConversion](https://developer.android.com/reference/androidx/media3/effect/ColorConversion), [ColorLut](https://developer.android.com/reference/androidx/media3/effect/ColorLut), [DebugViewEffect](https://developer.android.com/reference/androidx/media3/effect/DebugViewEffect), [FrameCache](https://developer.android.com/reference/androidx/media3/effect/FrameCache), [FrameDropEffect](https://developer.android.com/reference/androidx/media3/effect/FrameDropEffect), [GlMatrixTransformation](https://developer.android.com/reference/androidx/media3/effect/GlMatrixTransformation), [HslAdjustment](https://developer.android.com/reference/androidx/media3/effect/HslAdjustment), [LanczosResample](https://developer.android.com/reference/androidx/media3/effect/LanczosResample), [OverlayEffect](https://developer.android.com/reference/androidx/media3/effect/OverlayEffect), [RgbMatrix](https://developer.android.com/reference/androidx/media3/effect/RgbMatrix), [SeparableConvolution](https://developer.android.com/reference/androidx/media3/effect/SeparableConvolution), [SpeedChangeEffect](https://developer.android.com/reference/androidx/media3/effect/SpeedChangeEffect), [TimestampAdjustment](https://developer.android.com/reference/androidx/media3/effect/TimestampAdjustment), [TimestampWrapper](https://developer.android.com/reference/androidx/media3/effect/TimestampWrapper)

|---|---|
| `https://developer.android.com/reference/androidx/media3/effect/AlphaScale` | Scales the alpha value (i.e. the translucency) of a frame. |
| `https://developer.android.com/reference/androidx/media3/effect/ByteBufferGlEffect` | A `https://developer.android.com/reference/androidx/media3/effect/GlEffect` implementation that runs an asynchronous `https://developer.android.com/reference/androidx/media3/effect/ByteBufferGlEffect.Processor` on video frame data passed in as a `https://developer.android.com/reference/androidx/media3/effect/ByteBufferGlEffect.Image`. |
| `https://developer.android.com/reference/androidx/media3/effect/ColorConversion` | Converts frames from an input color space to an electrical output color space. |
| `https://developer.android.com/reference/androidx/media3/effect/ColorLut` | Specifies color transformations using color lookup tables to apply to each frame in the fragment shader. |
| `https://developer.android.com/reference/androidx/media3/effect/DebugViewEffect` | `https://developer.android.com/reference/androidx/media3/effect/GlEffect` that renders to a `https://developer.android.com/reference/android/view/SurfaceView.html` provided by `https://developer.android.com/reference/androidx/media3/common/DebugViewProvider`. |
| `https://developer.android.com/reference/androidx/media3/effect/FrameCache` | Caches the input frames. |
| `https://developer.android.com/reference/androidx/media3/effect/FrameDropEffect` | Drops frames to lower average frame rate to around `targetFrameRate`. |
| `https://developer.android.com/reference/androidx/media3/effect/GlMatrixTransformation` | Specifies a 4x4 transformation `https://developer.android.com/reference/android/opengl/Matrix.html` to apply in the vertex shader for each input frame. |
| `https://developer.android.com/reference/androidx/media3/effect/HslAdjustment` | Adjusts the HSL (Hue, Saturation, and Lightness) of a frame. |
| `https://developer.android.com/reference/androidx/media3/effect/LanczosResample` | A `https://developer.android.com/reference/androidx/media3/effect/GlEffect` that applies a Lanczos-windowed sinc function when resampling an image. |
| `https://developer.android.com/reference/androidx/media3/effect/OverlayEffect` | Applies a list of `https://developer.android.com/reference/androidx/media3/effect/TextureOverlay`s to a frame in FIFO order (the last overlay in the list is displayed on top). |
| `https://developer.android.com/reference/androidx/media3/effect/RgbMatrix` | Specifies a 4x4 RGB color transformation matrix to apply to each frame in the fragment shader. |
| `https://developer.android.com/reference/androidx/media3/effect/SeparableConvolution` | A `https://developer.android.com/reference/androidx/media3/effect/GlEffect` for performing separable convolutions. |
| `https://developer.android.com/reference/androidx/media3/effect/SpeedChangeEffect` | **This class is deprecated.** Use `EditedMediaItem.Builder#setSpeed(SpeedProvider)` instead. <br /> |
| `https://developer.android.com/reference/androidx/media3/effect/TimestampAdjustment` | **This class is deprecated.** Use `EditedMediaItem.Builder#setSpeed(SpeedProvider)` instead. <br /> |
| `https://developer.android.com/reference/androidx/media3/effect/TimestampWrapper` | Applies a `https://developer.android.com/reference/androidx/media3/effect/GlEffect` from `startTimeUs` to `endTimeUs`, and no change on all other timestamps. |

Known indirect subclasses [Brightness](https://developer.android.com/reference/androidx/media3/effect/Brightness), [Contrast](https://developer.android.com/reference/androidx/media3/effect/Contrast), [Crop](https://developer.android.com/reference/androidx/media3/effect/Crop), [GaussianBlurWithFrameOverlaid](https://developer.android.com/reference/androidx/media3/effect/GaussianBlurWithFrameOverlaid), [GaussianBlur](https://developer.android.com/reference/androidx/media3/effect/GaussianBlur), [MatrixTransformation](https://developer.android.com/reference/androidx/media3/effect/MatrixTransformation), [Presentation](https://developer.android.com/reference/androidx/media3/effect/Presentation), [RgbAdjustment](https://developer.android.com/reference/androidx/media3/effect/RgbAdjustment), [RgbFilter](https://developer.android.com/reference/androidx/media3/effect/RgbFilter), [ScaleAndRotateTransformation](https://developer.android.com/reference/androidx/media3/effect/ScaleAndRotateTransformation), [SingleColorLut](https://developer.android.com/reference/androidx/media3/effect/SingleColorLut)

|---|---|
| `https://developer.android.com/reference/androidx/media3/effect/Brightness` | Modifies brightness of an input frame. |
| `https://developer.android.com/reference/androidx/media3/effect/Contrast` | A `https://developer.android.com/reference/androidx/media3/effect/RgbMatrix` to control the contrast of video frames. |
| `https://developer.android.com/reference/androidx/media3/effect/Crop` | Specifies a crop to apply in the vertex shader. |
| `https://developer.android.com/reference/androidx/media3/effect/GaussianBlurWithFrameOverlaid` | A `https://developer.android.com/reference/androidx/media3/effect/SeparableConvolution` to apply a Gaussian blur on image data. |
| `https://developer.android.com/reference/androidx/media3/effect/GaussianBlur` | A `https://developer.android.com/reference/androidx/media3/effect/SeparableConvolution` to apply a Gaussian blur on image data. |
| `https://developer.android.com/reference/androidx/media3/effect/MatrixTransformation` | Specifies a 3x3 transformation `https://developer.android.com/reference/android/graphics/Matrix.html` to apply in the vertex shader for each frame. |
| `https://developer.android.com/reference/androidx/media3/effect/Presentation` | Controls how a frame is presented with options to set the output resolution and choose how to map the input pixels onto the output frame geometry (for example, by stretching the input frame to match the specified output frame, or fitting the input frame using letterboxing). |
| `https://developer.android.com/reference/androidx/media3/effect/RgbAdjustment` | Scales the red, green, and blue color channels of a frame. |
| `https://developer.android.com/reference/androidx/media3/effect/RgbFilter` | Provides common color filters. |
| `https://developer.android.com/reference/androidx/media3/effect/ScaleAndRotateTransformation` | Specifies a simple rotation and/or scale to apply in the vertex shader. |
| `https://developer.android.com/reference/androidx/media3/effect/SingleColorLut` | Transforms the colors of a frame by applying the same color lookup table to each frame. |

*** ** * ** ***

Interface for a video frame effect with a `https://developer.android.com/reference/androidx/media3/effect/GlShaderProgram` implementation.

Implementations contain information specifying the effect and can be `https://developer.android.com/reference/androidx/media3/effect/GlEffect#toGlShaderProgram(android.content.Context,boolean)` to a `https://developer.android.com/reference/androidx/media3/effect/GlShaderProgram` which applies the effect.

## Summary

| ### Public methods |
|---|---|
| `default boolean` | `https://developer.android.com/reference/androidx/media3/effect/GlEffect#isNoOp(int,int)(int inputWidth, int inputHeight)` Returns whether a `https://developer.android.com/reference/androidx/media3/effect/GlEffect` applies no change at every timestamp. |
| `abstract https://developer.android.com/reference/androidx/media3/effect/GlShaderProgram` | `https://developer.android.com/reference/androidx/media3/effect/GlEffect#toGlShaderProgram(android.content.Context,boolean)(https://developer.android.com/reference/android/content/Context.html context, boolean useHdr)` Returns a `https://developer.android.com/reference/androidx/media3/effect/GlShaderProgram` that applies the effect. |

### Inherited methods

From [androidx.media3.common.Effect](https://developer.android.com/reference/androidx/media3/common/Effect) `default long` `https://developer.android.com/reference/androidx/media3/common/Effect#getDurationAfterEffectApplied(long)(long durationUs)`

Returns the expected duration of the output stream when the effect is applied given a input `durationUs`.

## Public methods

### isNoOp

```
default boolean isNoOp(int inputWidth, int inputHeight)
```

Returns whether a `https://developer.android.com/reference/androidx/media3/effect/GlEffect` applies no change at every timestamp.

This can be used as a hint to skip this instance.

| Parameters |
|---|---|
| `int inputWidth` | The input frame width, in pixels. |
| `int inputHeight` | The input frame height, in pixels. |

### toGlShaderProgram

```
abstract GlShaderProgram toGlShaderProgram(Context context, boolean useHdr)
```

Returns a `https://developer.android.com/reference/androidx/media3/effect/GlShaderProgram` that applies the effect.

| Parameters |
|---|---|
| `https://developer.android.com/reference/android/content/Context.html context` | A `https://developer.android.com/reference/android/content/Context.html`. |
| `boolean useHdr` | Whether input textures come from an HDR source. If `true`, colors will be in linear RGB BT.2020. If `false`, colors will be in linear RGB BT.709. |

| Throws |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessingException` | If an error occurs while creating the `https://developer.android.com/reference/androidx/media3/effect/GlShaderProgram`. |