Search code examples
javaprocessbuilderx264

java processbuilder x264.exe


i want encoding a video with the x264 out of my own java application.

the problem is that the x264.exe start to work, and than it stop. the process not terminate, but froze. i try to run the x264 from terminal, that works fine. the problem must be in java.

here my code:

String[] command= new String[]{"cmd","/c","x264.exe ....";
ProcessBuilder pb = new ProcessBuilder(temp);
Process p = pb.start();
int ev = 0;
if (p.waitFor() != 0)
{
  ev = p.exitValue();
}

best regards, paul


Solution

  • i use the following log to analyse my problem:

    ProcessBuilder pb = new ProcessBuilder(temp);
    File log = new File("log");
    pb.redirectErrorStream(true);
    pb.redirectOutput(Redirect.appendTo(log));
    Process p = pb.start();int ev = 0;if (p.waitFor() != 0){ev = p.exitValue();}