Extracting frame from video from storage device using MediaMetadataRetriever - IllegalArgumentException at setDataSource()

杀马特。学长 韩版系。学妹 提交于 2020-03-04 19:35:49

问题


I want to extract one frame from video in my app. The video is chosen from my storage device. After trying to call setDataSource I'm getting an IllegalArgumentException.

Here is the part of my code:

MediaMetadataRetriever med = new MediaMetadataRetriever();
med.setDataSource(imageUri.toString());

A value of imageUri is:

content://com.android.providers.media.documents/document/video%3A59728

Is the path of my video in wrong format? I have also tried to use FFmpegMediaMetadataRetriever.


回答1:


use

med.setDataSource(context, imageUri)

if it does not work use MediaStore and get MediaStore URI



来源:https://stackoverflow.com/questions/60326306/extracting-frame-from-video-from-storage-device-using-mediametadataretriever-i

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!