FFmpeg始终处于onProgress状态OnSuccess / onFailure从未调用过Android

时间:2018-05-10 12:00:31

标签: android android-ffmpeg

这是我的Android

命令代码
try {
    String cmd[] = new String[]{"-i", video_file, "-ss", "00:04:00", "-i", audio_file, "-c:v", "copy", "-af", "apad", "-shortest", image.getPath()};

    ffmpeg.execute(cmd, new FFmpegExecuteResponseHandler() {
        @Override
        public void onSuccess(String message) {
            Log.e(TAG, "onSuccess: " + message);
        }

        @Override
        public void onProgress(String message) {
            Log.e(TAG, "onProgress: "+message);
        }

        @Override
        public void onFailure(String message) {
            Log.e(TAG, "onFailure: " + message);
        }

        @Override
        public void onStart() {
            Log.e(TAG, "onStart: ");
        }

        @Override
        public void onFinish() {
            Log.e(TAG, "onFinish: ");
        }
   });
} catch (FFmpegCommandAlreadyRunningException e) {
    e.printStackTrace();
}

1 个答案:

答案 0 :(得分:0)

您可以尝试放

  

-y

到ffmpeg命令行的开头。 因为ffmpeg不会覆盖现有文件或文件路径。 示例:

"-y -i..."