@UnstableApi
class FrameExtractor : 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 software or hardware decoders across a wide range of devices.
  • Other inputs are likely to produce accurate output when using hardware decoders on devices that are launched with API 33 or later.
  • HDR inputs will produce a Bitmap with BT2020_HLG. There are no guarantees that an HLG Bitmap displayed in ImageView and an HLG video displayed in SurfaceView will look the same.
  • Depending on the device and input video, color inaccuracies can be mitigated with an appropriate RgbMatrix effect.

Summary

Nested types

A builder for FrameExtractor instances.

Stores an extracted and decoded video frame.

Public functions

Unit

Releases the underlying resources.

ListenableFuture<FrameExtractor.Frame!>!
getFrame(positionMs: Long)

Extracts a representative Frame for the specified video position.

ListenableFuture<FrameExtractor.Frame!>!

Public functions

close

fun close(): Unit

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

fun getFrame(positionMs: Long): ListenableFuture<FrameExtractor.Frame!>!

Extracts a representative Frame for the specified video position.

Parameters
positionMs: Long

The time position in the MediaItem for which a frame is extracted, in milliseconds.