Skip to content

Latest commit

 

History

History
76 lines (52 loc) · 3.42 KB

video_frame.md

File metadata and controls

76 lines (52 loc) · 3.42 KB

Video Frame

Translations: 简体中文

Sketch provides the sketch-video-* series of modules to support decoding video frames

Module DecoderProvider Decoder Android iOS Desktop Web
sketch-video VideoFrameDecoderProvider VideoFrameDecoder ✅(API 27)
sketch-video-ffmpeg FFmpegVideoFrameDecoderProvider FFmpegVideoFrameDecoder

Install component

${LAST_VERSION}: Download (Not included 'v')

implementation("io.github.panpf.sketch4:sketch-video:${LAST_VERSION}")
// or
implementation("io.github.panpf.sketch4:sketch-video-ffmpeg:${LAST_VERSION}")

Important

The above components all support automatic registration. You only need to import them without additional configuration. If you need to register manually, please read the documentation: 《Register component》

Configuration

ImageRequest and ImageOptions support some video frame-related configurations, as follows:

ImageRequest(context, "file:///sdcard/sample.mp4") {
    // Extract the frame at 1000000 microseconds
    videoFrameMicros(1000000)

    // or extract the frame at 10000 ms
    videoFrameMillis(10000)

    // or get the frames in between
    videoFramePercentDuration(0.5f)

    // Set the processing strategy when frames cannot be extracted at the specified time
    videoFrameOption(MediaMetadataRetriever.OPTION_CLOSEST)
}