繁体   English   中英

Runtime.getRuntime.exec() 问题

[英]Runtime.getRuntime.exec() problem

您好我正在尝试执行 Runtime.getRuntime.exec("ffmpeg -i inputfile image2 imagefile");

我的代码中的输入文件是视频文件,我正在通过 GUI 选择视频文件

我将它存储在一个变量中。那么我如何使用变量名代替字符串?它确实

如果我替换变量,则不起作用。 任何帮助都是很大的应用程序

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

这里没有魔法,它只是一根绳子。

你需要这样的命令数组:

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM