我有175個mp4文件。當我處理從指數0至指數65(或66)文件,我得到異常:FFMPeg異常setDataSource失敗:狀態= 0xFFFFFFFF
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)
如果我運行從指數65(或附近)工藝,處理文件65是成功的。但它仍然得到例外,有時 這裏是代碼我使用的:
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
請幫助我。
你設置的manifest.xml烏爾讀取權限? –