开发者

Runtime.getRuntime.exec() problem

开发者 https://www.devze.com 2023-03-02 11:31 出处:网络
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

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

精彩评论

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