-1

在我的 android 应用程序中,我想提取视频帧。我正在使用 MediaMetaDataRetriever。

我如何设置数据源

 Log.d("DEBUG", videoPathUri.getPath());
 metadataRetriever.setDataSource(mContext, videoPathUri);

这是日志输出

/storage/emulated/0/Android/data/com.live.hootout/files/HootVideos/10701.mp4

如何将存储在 android 数据文件夹中的视频加载到 mediametadataretriever 中?

4

2 回答 2

0

尝试这个...

File file = new File(context.getDataDir(),filename);
于 2018-07-06T09:16:37.123 回答
0

这是我的做法。

File file = new File(videoPathUri.getPath());
try {
        FileInputStream inputStream = new FileInputStream(file.getAbsolutePath());
      metadataRetriever.setDataSource(inputStream.getFD());
    }catch(FileNotFoundException e){
       Log.d("DEBUG", "FileNotFoundException", e);
    }catch(IOException ea){
       Log.d("DEBUG", "IOException", ea);
    }
于 2018-07-06T09:51:53.437 回答