提取的Andr​​oid所有的视频​​帧 [英] extract all video frames in Android

查看:756
本文介绍了提取的Andr​​oid所有的视频​​帧的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我录视频为有限的时间。现在我想获取视频的所有帧。我现在用的是跌破code和利用它,我能够得到帧,但我没有得到所有的视频​​帧。重复3〜4帧,然后我得到一个不同的帧。但大家都知道,我们可以得到在第二个25〜30帧的显示流畅的视频。如何获得所有帧。

I recorded a Video for limited time. Now i want to fetch all frames of video. I am using the below code and by using it i am able to get frames but i am not getting all video frames. 3 to 4 frames are repeated then i got a different frame. But as we all know we can get 25- 30 frames in a second to display smooth video. How to get all frames.

 for (int i = 0; i < 30; i++) {

                    Bitmap bArray = mediaMetadataRetriever.getFrameAtTime(
                            1000000 * i,
                            MediaMetadataRetriever.OPTION_CLOSEST);

                    savebitmap(bArray, 33333 * i);

                }

我不希望使用NDK。我得到了这个链接不知道什么应该是ARGB8888的值。我在这里得到错误。谁能解释如何做到这一点。 获取Android中从视频图像帧

I don't want to use NDK. I got this link don't know what should be the value for "argb8888". I am getting error here. Can anyone explain how to do it. Getting frames from Video Image in Android

推荐答案

我之前遇到过同样的问题,在Android的类MediaMetadataRetriever似乎没有拨给这个任务,因为它没有一个良好的precision。 我用了一个在机器人工作室称为FFmpegMediaMetadataRetriever库:

I faced the same problem before and the Android's MediaMetadataRetriever seems not appropriated for this task since it doesn't have a good precision. I used a library called "FFmpegMediaMetadataRetriever" in android studio:

  1. 在添加此行的build.graddle下模块的应用程序:

编译com.github.wseemann:FFmpegMediaMetadataRetriever:1.0.1

compile 'com.github.wseemann:FFmpegMediaMetadataRetriever:1.0.1'

使用的FFmpegMediaMetadataRetriever类获取更高的precision帧:

  1. Rebuild your project.
  2. Use the FFmpegMediaMetadataRetriever class to grab frames with higher precision:

FFmpegMediaMetadataRetriever MED =新FFmpegMediaMetadataRetriever();   med.setDataSource(数据源);

FFmpegMediaMetadataRetriever med = new FFmpegMediaMetadataRetriever(); med.setDataSource("your data source");

在你的循环中,您可以通过抓取帧:

and in your loop you can grab frame using:

 Bitmap bmp = med.getFrameAtTime(i*1000000, FFmpegMediaMetadataRetriever.OPTION_CLOSEST);

这篇关于提取的Andr​​oid所有的视频​​帧的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆