如何在android中使用FFMPEG修剪视频

时间:2016-04-26 05:57:43

标签: android android-studio ffmpeg android-ndk java-native-interface

我得到了

  

致命信号11(SIGSEGV),代码1,tid 5823中的故障地址0x5(e.mypc.videocut)

当我尝试调试应用程序崩溃时,我正在阅读此行:

vk.run(complexCommand, workFolder, getApplicationContext());

VideoTrim屏幕:

PowerManager powerManager = (PowerManager)VideoCut.this.getSystemService(Activity.POWER_SERVICE);
PowerManager.WakeLock wakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "VK_LOCK");
Log.d(Prefs.TAG, "Acquire wake lock");
wakeLock.acquire();

LoadJNI vk = new LoadJNI();
try {
    String workFolder=  getApplicationContext().getFilesDir().getAbsolutePath();
    Log.d("workfolder",workFolder);
    String[] complexCommand = {"ffmpeg", "-i", path, "-ss 00:00:03 -t 00:00:08 -async 1", "/storage/emulated/0/VID.mp4"};

    // String commandStr = "ffmpeg -i "+path +"-ss 00:00:03 -t 00:00:08 -async 1 /storage/emulated/0/DCIM/Camera/VID.mp4";
    vk.run(complexCommand, workFolder, getApplicationContext());

    Log.i("test", "ffmpeg4android finished successfully");
    GeneralUtils.copyFileToFolder(vkLogPath, demoVideoFolder);

} catch (Throwable e) {
    Log.e("test", "vk run exception.", e);

} finally {
    if (wakeLock.isHeld()) {
        wakeLock.release();
        Log.i(Prefs.TAG, "Wake lock released");

    } else {
        Log.i(Prefs.TAG, "Wake lock is already released, doing nothing");
    }
}

1 个答案:

答案 0 :(得分:0)

我有一种强烈的感觉,你为不同的ABI建立了ffmpeg。请提供有关您的环境的更多信息。