我已经在android中创建了慢动作视频应用,并且我可以尝试在视频总长度的任何开始和结束位置中设置视频运动速度。

但是在启动FFmpegFrameGrabber中会发生一些错误。

这是我的代码:

private class PrepareMedia extends AsyncTask<Void, Void, Void> {
    private PrepareMedia() {
    }

    protected Void doInBackground(Void... params) {
        FFmpegFrameGrabber grabber = new FFmpegFrameGrabber(viewSource);
        try {
            grabber.start();
            grabber.stop();
            grabber.release();
        } catch (Exception e) {
            Log.e(TAG, "doInBackground: ");
        }
        return null;
    }
}


查看我的错误。

01-12 15:59:16.374 14990-14990/com.example.slowmotiondemo E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.example.slowmotiondemo, PID: 14990
    java.lang.UnsatisfiedLinkError: org.bytedeco.javacpp.avutil
        at java.lang.Class.classForName(Native Method)
        at java.lang.Class.forName(Class.java:324)
        at org.bytedeco.javacpp.Loader.load(Loader.java:585)
        at org.bytedeco.javacpp.Loader.load(Loader.java:530)
        at org.bytedeco.javacpp.avformat$AVFormatContext.<clinit>(avformat.java:2819)
        at org.bytedeco.javacv.FFmpegFrameGrabber.startUnsafe(FFmpegFrameGrabber.java:468)
        at org.bytedeco.javacv.FFmpegFrameGrabber.start(FFmpegFrameGrabber.java:462)
        at com.example.slowmotiondemo.ActivityCutMergeVideo.prepareMediaForOreantation(ActivityCutMergeVideo.java:687)
        at com.example.slowmotiondemo.ActivityCutMergeVideo.onCreate(ActivityCutMergeVideo.java:507)
        at android.app.Activity.performCreate(Activity.java:6904)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1136)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3266)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3415)
        at android.app.ActivityThread.access$1100(ActivityThread.java:229)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1821)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:148)
        at android.app.ActivityThread.main(ActivityThread.java:7331)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)


请告诉我如何解决错误。

最佳答案

首先尝试手动安装javacv(https://github.com/bytedeco/javacv#manual-installation)。

然后尝试从jar中提取.so文件,并将其放入app / src / main / jniLibs中。

如果那也行不通,请使用本手册:
https://github.com/bytedeco/javacpp-presets/wiki/The-UnsatisfiedLinkError-X-File-%28a-real-experience%29

10-07 20:06