FrameExtractor
@UnstableApi
public final class FrameExtractor implements AutoCloseable
Extracts decoded frames from MediaItem.
Frame extractor instances must be accessed from a single application thread.
This class may produce incorrect or washed out colors, or images that have too high contrast for inputs not covered by testDecodeGlAccuracyRGB CTS test. That is:
- Inputs of BT.601 limited range are likely to produce accurate output with either
softwareorhardwaredecoders across a wide range of devices. - Other inputs are likely to produce accurate output when using
hardwaredecoders on devices that are launched with API 33 or later. - HDR inputs will produce a
BitmapwithBT2020_HLG. There are no guarantees that an HLGBitmapdisplayed inImageViewand an HLG video displayed inSurfaceViewwill look the same. - Depending on the device and input video, color inaccuracies can be mitigated with an appropriate
RgbMatrixeffect.
Summary
Nested types |
|---|
public final class FrameExtractor.BuilderA builder for |
public final class FrameExtractor.FrameStores an extracted and decoded video frame. |
Public methods |
|
|---|---|
void |
close()Releases the underlying resources. |
ListenableFuture<FrameExtractor.Frame> |
getFrame(long positionMs)Extracts a representative |
ListenableFuture<FrameExtractor.Frame> |
Public methods
close
public void close()
Releases the underlying resources. This method must be called when the frame extractor is no longer required. The frame extractor must not be used after calling this method.
getFrame
public ListenableFuture<FrameExtractor.Frame> getFrame(long positionMs)
Extracts a representative Frame for the specified video position.
| Parameters | |
|---|---|
long positionMs |
The time position in the |
| Returns | |
|---|---|
ListenableFuture<FrameExtractor.Frame> |
A |