Sunday, 25 August 2013

executing cd command and ffmpeg in java

executing cd command and ffmpeg in java

How to run cd command(In linux Ubuntu) and ffmpeg on the changed directory
The jsp code given below:
String cmd = "cd "+getServletContext().getRealPath("/")+"Files/videos/";
out.println(cmd);
ProcessBuilder pb = new ProcessBuilder(
"/bin/sh", "-c",
cmd + "&& ffmpeg -i nature.MP4");
Process p = pb.start();
BufferedReader in = new BufferedReader(
new InputStreamReader(p.getInputStream()) );
String line;
out.println("Meta-data...");
while ((line = in.readLine()) != null) {
out.println(line);
}
in.close();

No comments:

Post a Comment