1
我的代碼:FFmpeg.execute.FFmpegExecuteResponseHandler對空對象引用
submit.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
execFFmpegBinary(" -i" + newFile.getAbsolutePath() + " -codec:v libx264 -profile:v high -preset slow -b:v 500k -maxrate 500k -bufsize 1000k -vf scale=-1:480 -threads 0 -pass 2 -codec:a libfdk_aac -b:a 128k -f mp4 " + dest1.getAbsolutePath());
}
});
public void execFFmpegBinary(final String command) {
try {
Log.d("path....",command);
ffmpeg.execute(command, new ExecuteBinaryResponseHandler() {
@Override
public void onFailure(String s) {
Log.d(TAG, "FAILED with output : " + s);
}
@Override
public void onSuccess(String s) {
Log.d(TAG, "SUCCESS with output : "+s);
}
@Override
public void onProgress(String s) {
Log.d(TAG, "Started command : ffmpeg "+command);
Log.d(TAG, "progress : " + s);
}
@Override
public void onStart() {
Log.d(TAG, "Started command : ffmpeg " + command);
progressDialog.setMessage("Processing...");
progressDialog.show();
}
@Override
public void onFinish() {
Log.d(TAG, "Finished command : ffmpeg " + command);
progressDialog.dismiss();
}
});
} catch (FFmpegCommandAlreadyRunningException e) {
// do nothing for now
}
}
顯示此錯誤:
FATAL EXCEPTION: main
Process: com.example.mypc.videocut, PID: 26910
java.lang.NullPointerException: Attempt to invoke virtual method 'void com.github.hiteshsondhi88.libffmpeg.FFmpeg.execute(java.lang.String, com.github.hiteshsondhi88.libffmpeg.FFmpegExecuteResponseHandler)' on a null object reference