Wednesday, April 18, 2012

External command does not execute completely - Java

So, I am building a program that converts .flv files to other formats.
For that I'm using ffmpeg which does its job perfectly when executing it via command line. For example:



ffmpeg -i C:\test.flv -acodec libmp3lame -y C:\test.mp3


This example works like a charm - there isn't a single problem when executing the command.



BUT when I try to execute the same command from within a Java class a problem occurs. I do this in a try-catch block:



System.out.println("Start");
Process p = Runtime.getRuntime().exec("cmd /c ffmpeg -i C:\test.flv -acodec libmp3lame -y C:\test.mp3");
System.out.println("End");


The console prints "Start". It starts converting and it doesn't finish.

Can somebody help me?





No comments:

Post a Comment