在java中执行cd命令和ffmpeg

时间:2013-08-25 18:35:04

标签: java jsp ffmpeg command execution

如何在更改的目录上运行cd命令(在Linux Ubuntu中)和ffmpeg。以下jsp程序对我不起作用。

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();

提前致谢...

0 个答案:

没有答案