Image overlay on video
List<String> cmdList = new ArrayList<>();
cmdList.add("-i");
cmdList.add(videoPath);
cmdList.add("-i");
cmdList.add(overly_image_path);
cmdList.add("-filter_complex");
cmdList.add("[1:v]scale=h=" + overly_image_height + ":w=" + overly_image_width +
"[overlay_scaled],[0:v][overlay_scaled]overlay=eval=init:x=" + overly_image_x + ":y=" + overly_image_y);
cmdList.add("-frames:v");
cmdList.add("900");
cmdList.add("-crf");
cmdList.add("18");
cmdList.add("-preset");
cmdList.add("ultrafast");
cmdList.add("-vb");
cmdList.add("20M");
cmdList.add(outputVideoPath);
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
Post a Comment