I have an application written in java that needs read videos from a directory and convert them using ffmpeg. I already have ffmpeg installed on my pc and i want use it in my program using "ProcessBuilder", here a sample code:
List<String> cmds = new ArrayList<>();
cmds.add("ffmpeg");
cmds.add("-i");
cmds.add("video1.avi");
cmds.add("video2.mp4");
cmds.add("-hide_banner");
ProcessBuilder pb = new ProcessBuilder(cmds);
Process p = pb.start();
p.waitFor();
The ffmpeg process is created and as expected my app is blocked until ffmpeg process finish its job, but the process never finish, it create a file with 2mb of size and then pause the convertion, and never finish, when i kill my java application the ffmpeg process continue the convertion, i need wait for the completion of the task and notify that the convertion is finished, any idea?, thanks