FFMPeg异常setDataSource失败:状态= 0xFFFFFFFF [英] FFMPeg exception setDataSource failed: status = 0xFFFFFFFF

查看:970
本文介绍了FFMPeg异常setDataSource失败:状态= 0xFFFFFFFF的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有175个mp4文件。当我从索引0到索引65(或66)处理文件时,出现异常:

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)

如果我从索引65(或附近)运行进程,则处理文件65成功。但是有时它还是会出现异常
这是我正在使用的代码:

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

请帮助我。

推荐答案

错误很简单, IllegalArgumentException 表示视频URI无效,如果发生这种情况,则会引发异常。尝试与 FFmpegMediaMetadataRetriever 一起使用之前,请验证URI是否有效。

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.

这篇关于FFMPeg异常setDataSource失败:状态= 0xFFFFFFFF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆