Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/230.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在Android中检索视频帧_Android_Android Studio - Fatal编程技术网

在Android中检索视频帧

在Android中检索视频帧,android,android-studio,Android,Android Studio,我正在尝试获取.mp4文件的视频帧: String fontPath = "test.mp4"; Bitmap b = getVideoFrame(fontPath); 我的职能是: public static Bitmap getVideoFrame(String FD) { MediaMetadataRetriever retriever = new MediaMetadataRetriever(); try { retriever.setDataSourc

我正在尝试获取.mp4文件的视频帧:

String fontPath = "test.mp4";
Bitmap b = getVideoFrame(fontPath);
我的职能是:

public static Bitmap getVideoFrame(String FD) {
    MediaMetadataRetriever retriever = new MediaMetadataRetriever();
    try {
        retriever.setDataSource(FD);
        return retriever.getFrameAtTime();
    } catch (RuntimeException ex) {
        ex.printStackTrace();
    } finally {
        try {
            retriever.release();
        } catch (RuntimeException ignored) {
        }
    }
    return null;
}
但是我在那一行得到了错误
IllegalArgumentException

retriever.setDataSource(FD);

test.mp4
在我的项目中的资产目录中。

没有,但我不知道如何确定。我尝试了不同的方法来获取路径,但每次都会出现此错误