FFMPeg exception setDataSource failed: status = 0xFFFFFFFF

匿名 (未验证) 提交于 2019-12-03 09:02:45

问题:

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(Native Method) at com.jni.utils.Mp4ParserUsingFFMpeg.createThumbnail(Mp4ParserUsingFFMpeg.java:518) at com.example.readmdtfile.activity.MainActivity$createMp4Async.createThumbnail(MainActivity.java:71) at com.example.readmdtfile.activity.MainActivity$createMp4Async.doInBackground(MainActivity.java:55) at com.example.readmdtfile.activity.MainActivity$createMp4Async.doInBackground(MainActivity.java:1) at android.os.AsyncTask$2.call(AsyncTask.java:288) at java.util.concurrent.FutureTask.run(FutureTask.java:237) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) at java.lang.Thread.run(Thread.java:841) 

If I run process from index 65 (or nearby), processing file 65 is successful. But it still get exception sometimes Here is code which i'm using:

public static Bitmap createThumbnail (String videoPath) {     FFmpegMediaMetadataRetriever retriever = new  FFmpegMediaMetadataRetriever();     Bitmap bitmap = null;     try {         retriever.setDataSource(videoPath); //file's path         String key;         String value;         for (int i = 0; i < MetadataKey.METADATA_KEYS.length; i++) {             key = MetadataKey.METADATA_KEYS[i];             value = retriever.extractMetadata(key);             if (value != null) {                 // metadata.add(new Metadata(key, value));                 Log.i(TAG, "Key: " + key + " Value: " + value);             }         }          bitmap = retriever.getFrameAtTime();          if (bitmap != null) {             Log.d(TAG, "Extracted frame");             Bitmap b2 = retriever.getFrameAtTime(4000000,                     FFmpegMediaMetadataRetriever.OPTION_CLOSEST_SYNC);             if (b2 != null) {                 bitmap = b2;             }         } else {             Log.d(TAG, "Failed to extract frame");         }     } catch (Exception e) {         e.printStackTrace();     } finally {         retriever.release();     }      return bitmap; } 

https://github.com/wseemann/FFmpegMediaMetadataRetriever/issues/59

Please help me.

回答1:

The error is simple, an IllegalArgumentException means the video URI is invalid, if this occurs an exception is thrown. Verify the URI is valid before attempting to use it with FFmpegMediaMetadataRetriever.



回答2:

you just have to give setDataSource a String, save your path or url in a string like this:

String url; mmr = new FFmpegMediaMetadataRetriever(); url = "http://www.stephaniequinn.com/Music/Commercial%20DEMO%20-%2009.mp3"; mmr.setDataSource(url, new HashMap<String, String>()); 

or:

mmr = new FFmpegMediaMetadataRetriever(); string s="path" mmr.setDataSource(path); 


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