正如有人在stackoverflow中建议的那样,我尝试使用代码从视频中逐个获取帧,如下所示:
String STR=(String) Environment.getExternalStorageDirectory().getAbsolutePath();
FrameGrabber videoGrabber = new FFmpegFrameGrabber(STR+"/vd.3gpp");
try
{
videoGrabber.setFormat("video format goes here");
videoGrabber.start();
} catch (com.googlecode.javacv.FrameGrabber.Exception e)
{
Log.e("javacv", "Failed to start grabber" + e);
return ;
}
Frame vFrame = null;
do
{
try
{
vFrame = videoGrabber.grabFrame();
if(vFrame != null);
//do your magic here
} catch (com.googlecode.javacv.FrameGrabber.Exception e)
{
Log.e("javacv", "video grabFrame failed: "+ e);
}
}while(vFrame != null);
try
{
videoGrabber.stop();
}catch (com.googlecode.javacv.FrameGrabber.Exception e)
{
Log.e("javacv", "failed to stop video grabber", e);
return ;
}
但我意外地无法运行应用程序。任何人都可以建议我从存储的视频中获取所有帧的解决方案吗?