4

I have seen many similar questions like mine, but i have one difference i need to do this in java not in c/c++ and i need it work on android devices.

I found 1 way to do it with the "MediaMetadataRetriever".

but it takes me too long to seperate the frames(~1 sec to frame) and i need to read like 600 frames so it takes me 10 minutes only to read the images without the image processing.

I would like to know if there is another way to split the frames from a video, or manipulate MediaMetadataRetriever and make it work fast.

Thanks alot!

4

1 回答 1

3

听起来您想使用MediaCodec解码器。这里有一些例子。

特别是,如果您查看 DecodeEditEncodeTest 代码,该checkVideoFile()函数将先前创建的流解码为外部纹理,然后使用 OpenGL ES 对其进行操作。(要从 .mp4 文件执行此操作,您需要通过 .mp4 访问它MediaExtractor。)

MediaMetadataRetriever#getFrameAtTime()确实是为了提取缩略图,并不是特别适合提取大量帧。

更新:现在有使用、和 GLES (API 16+)提取视频帧的示例代码。MediaExtractorMediaCodec

于 2013-10-23T18:03:14.403 回答