我想将1.rmvb转换为带有mencoder的avi;
和。的文件夹 /应用/ tongweb02 /部署/模块/ CMS-网/静态/上传/视频/产地/ 2015/03/03 / 和 /应用/ tongweb02 /部署/模块/ CMS-网/静态/上传/视频/ FLV / 2015/03/03 / 已退出,
java代码
String getter = null;
String toAvi = "mencoder "
+ originPath
+ " -o "
+ aviPath
+ " -vf scale=320:240 -oac pcm -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=500";
try{
ProcessBuilder builder = new ProcessBuilder();
builder.command(toAvi);
builder.redirectErrorStream(true);
Process proc = builder.start();
BufferedReader stdout = new BufferedReader(
new InputStreamReader(proc.getInputStream()));
String line;
while ((line = stdout.readLine()) != null) {
getter += line + ",";
if( getter != null )
System.out.println(line);
}
proc.waitFor();
stdout.close();
}
catch (Exception e) {
e.printStackTrace();
return false;
}
它给了我以下错误:
[2015-03-03 15:23:37] [WARNING] [System.out] [java.io.IOException: Cannot run program "mencoder /app/tongweb02/deployment/modules/cms-web/static/upload/video/origin/2015/03/03/1.rmvb -o /app/tongweb02/deployment/modules/cms-web/static/upload/video/videoTemp/1425367417356.avi -vf scale=320:240 -oac pcm -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=500": java.io.IOException: error=2, No such file or directory]
任何人都可以帮我解决问题。
答案 0 :(得分:0)
String getter = null;
String toAvi = "mencoder "
+ originPath
+ " -o "
+ aviPath
+ " -vf scale=320:240 -oac pcm -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=500";
try{
Runtime rt = Runtime.getRuntime();
Process proc = rt.exec(toAvi);
BufferedReader stdout = new BufferedReader(
new InputStreamReader(proc.getInputStream()));
String line;
while ((line = stdout.readLine()) != null) {
getter += line + ",";
if( getter != null )
System.out.println(line);
}
proc.waitFor();
stdout.close();
}
catch (Exception e) {
e.printStackTrace();
return false;
}
return true;