开发者

Runtime.getRuntime.exec() problem

hi I am trying to execute the Runtime.getRuntime.exec("ffmpeg -i inputfile image2 imagefile");

the input file in my code is the video file and i'm selecting the video file through the GUI

and i store it in a variable.So how can i use a variable name in place of the开发者_如何学Python String?.It does

not work if i substitute the variable. Any help is greatly app


String inputfileVariable = ...; << maybe you calculate, maybe get from some GUI component
Runtime.getRuntime.exec("ffmpeg -i " +  inputfileVariable + " image2 imagefile");

There's no magic here, it's only a string.


You need command array like this:

// i guess that ffmpeg is a command name and the reset are arguments
Runtime.getRuntime().exec(new String[] {"ffmpeg","-i",inputfileVariable,"image2", "imagefile"});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜