Search code examples
javawindows-7processreturn

ffmpeg executed from Java's processbuilder does not return under windows 7


I was trying to build up a ProcessBuilder calling the ffmpeg binary. My problem is that calling it, it returns perfectly under MacOs, Ubuntu and WindowsXp, but under Windows7 the waitFor() never returns.

Has anyone similar experience under windows 7? Any help would be appreciated!

My command:

ProcessBuilder pb = new ProcessBuilder( );

pb.command( "C:\\Windows\\System32\\cmd.exe", "/c", "c:\\ffmpeg\\bin\\ffmpeg.exe", "-version" ); 

Tried these ones too:

pb.command( "c:\\ffmpeg\\bin\\ffmpeg.exe", "-version" ); 
pb.command( "C:\\Windows\\System32\\cmd.exe", "/c", "start c:\\ffmpeg\\bin\\ffmpeg.exe -version" ); 

Result is the same. :(


Solution

  • Looks like your process writes something in its out and/or err streams. Their buffer overflow and process blocks. You should read out and err streams of your process to avoid this.

    See "When Runtime.exec() won't" for more information