Android MediaMetadataRetriever setDataSource failed

mediametadataretriever example android
java lang illegalargumentexception setdatasource failed: status = 0xffffffff
import android media mediametadataretriever
mediametadataretriever not working
metaretriver setdatasource
setdatasource ioexception
mediametadataretriever maven
android video metadata

I'm trying to use Android MediaMetadataRetriever to get the length of recoreded videos in mp4 format - but i'm getting the exception:

07-13 13:54:32.686: E/AndroidRuntime(19790): FATAL EXCEPTION: main
07-13 13:54:32.686: E/AndroidRuntime(19790): java.lang.RuntimeException: setDataSource failed: status = 0x80000000

My code is:

MediaMetadataRetriever retriever = new MediaMetadataRetriever();
            retriever.setDataSource(video.getMediaUrl());
            String time = retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_DURATION);
            long timeInmillisec = Long.parseLong(time);

And the video.getMediaUrl() path is similiar to this:

file:///storage/emulated/0/Foldername/Videos/VID_20130713_135318.mp4

I don't know what i am doing wrong - anyone help me out, please! Also this code works fine for Audio Files, but not for videos.


public static String getFileDuration(Context context, File file) {
    String result = null;
    MediaMetadataRetriever retriever = null;
    FileInputStream inputStream = null;

    try {
        retriever = new MediaMetadataRetriever();
        inputStream = new FileInputStream(file.getAbsolutePath());
        retriever.setDataSource(inputStream.getFD());
        long time = Long.parseLong(retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_DURATION));
        result = String.format(context.getResources().getString(R.string.player_time_format),
        AppUtil.getPlayerMinutes(time), AppUtil.getPlayerSoconds(time));

    } catch (FileNotFoundException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    } catch (RuntimeException e) {
        e.printStackTrace();
    } finally{
       if (retriever != null){
           retriever.release()
       }if (inputStream != null){
           inputStream.close()
       }
    }  
    return result;
}

android.media.MediaMetadataRetriever.setDataSource java code , RuntimeException: setDataSource failed: status = 0x80000000 @modplug , That SO question is about MediaMetadataRetriever, not  Re: MediaMetadataRetriever setDataSource failed: status = 0xFFFFFFED I'm using Java in Android Studio to make an Android App, very very sorry if this is the wrong place to post this question. When it worked it was from that url also, not local ( oh how I wish I saved that code when it worked ).


Remove file:// from video URI before passing it to setDataSource method.

Local files not working on some Android devices · Issue #18 , RuntimeException: setDataSource failed: status = 0x80000000 at android.media.​MediaMetadataRetriever.setDataSource(Native Method) at  I try to get some metadata informations from jpg file in my android app using android.media.MediaMetadataRetriever. Here is my code: public long getDuration(String videoFilePath, Context context)


Kirill F.'s answer helped me fix this error.

path = path.substring(7);
mmr.setDataSource(path);

RuntimeException: setDataSource failed · Issue #980 · bumptech , MediaMetadataRetriever class provides a unified interface for retrieving frame and meta data from an input media Call this method after setDataSource(). Bitmap, A Bitmap containing the requested video frame, or null if the retrieval fails​. retriever.setDataSource(context, uri); I have the sama problem, check the uri is correct. if the video is .mp4 is ok, but .mov is wrong. i think my case is not invalid URI cause


FileInputStream works for me.

String path = "somepath"; java.io.FileInputStream input = new FileInputStream(path); mediaMetadataRetriever.setDataSource(input.getFD());

MediaMetadataRetriever.SetDataSource Method (Android.Media , This page provides Java code examples for android.media.​MediaMetadataRetriever. extractMetadata(MediaMetadataRetriever. setDataSource() fail:" + e. I have 175 mp4 files. When I process file from index 0 to index 65 (or 66), I get exception: java.lang.IllegalArgumentException: setDataSource failed: status = 0xFFFFFFFF at wseemann.media.FFmpegMediaMetadataRetriever.setDataSource(Nativ


MediaMetadataRetriever, RuntimeException: setDataSource failed: status = 0x80000000 at android.media.​MediaMetadataRetriever.setDataSource(Native Method) at android.media. MediaMetadataRetriever.setDataSource(Native Method) causes RuntimeException: status = 0xFFFFFFEA setDataSource failed: status = 0xFFFFFFEA } I'm not a great


Java Code Examples android.media.MediaMetadataRetriever , Re: MediaMetadataRetriever setDataSource failed: status = 0xFFFFFFED. I'm using Java in Android Studio to make an Android App, very very  Seems like Glide is trying to save an unavailable URL jpeg-resource into disk cache and generates java.io.IOException(java.lang.RuntimeException: setDataSource failed: status = 0x80000000) on background thread in my case .


task: fix crash when exporting mixed media stories on Builds , RuntimeException at android.media.MediaMetadataRetriever. MediaMetadataRetriever setDataSource failed: status = 0xFFFFFFED. on Stack Overflow by