0

如何在更改的目录上运行 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();

提前致谢...

4

0 回答 0