-
public final class MediaCodecExtractImagesExtract frames from an MP4 using MediaExtractor, MediaCodec, and GLES. Put a .mp4 file in "/sdcard/source.mp4" and look for output files named "/sdcard/frame-XX.png".
This uses various features first available in Android "Jellybean" 4.1 (API 16).
(This was derived from bits and pieces of CTS tests, and is packaged as such, but is not currently part of CTS.)
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public final classMediaCodecExtractImages.Cancelablepublic classMediaCodecExtractImages.Companion
-
Constructor Summary
Constructors Constructor Description MediaCodecExtractImages()
-
Method Summary
-
-
Method Detail
-
extractMpegFrames
final Observable<Progress> extractMpegFrames(Uri inputVideo, List<Double> timeInSec, Uri outputDir, Integer photoQuality)
Tests extraction from an MP4 to a series of PNG files.
We scale the video to 640x480 for the PNG just to demonstrate that we can scale the video with the GPU. If the input video has a different aspect ratio, we could preserve it by adjusting the GL viewport to get letterboxing or pillarboxing, but generally if you're extracting frames you don't want black bars.
-
-
-
-