Crop video using Ffmpeg

Crop Video

List<String> cmdList = new ArrayList<>();

cmdList.add("-i")

cmdList.add(inputPath)

cmdList.add("-vf")

cmdList.add("crop=$width:$height:$x:$y")

cmdList.add("-crf")

cmdList.add("18")

cmdList.add("-preset")

cmdList.add("ultrafast")

cmdList.add("-strict")

cmdList.add("-2")

cmdList.add("-c:a")

cmdList.add("copy")

cmdList.add("-vb")

cmdList.add("20M")

cmdList.add(outputPath)


int returnCode = FFmpeg.execute(cmdList.toTypedArray())


if (returnCode == FFmpeg.RETURN_CODE_SUCCESS) {

    // Completed successfully.

} else if (returnCode == FFmpeg.RETURN_CODE_CANCEL) {

    // Cancelled by user.

} else {

    // Command execution failed

}

Comments