Process Builder won't accept ffmpeg arguments

时光总嘲笑我的痴心妄想 提交于 2019-12-24 13:14:18

问题


I'm trying to open a process (ffmpeg) using the Java ProcessBuilder. So far so good but I can't really pass any arguments to the process.

The ProcessBuilder just won't use the right arguments.

Here's my code so far:

ProcessBuilder builder    = new ProcessBuilder("ffmpeg/ffmpeg.exe", "-i " + this.inputFile.getAbsolutePath(), "-c:v libvpx", "-minrate " + iBitrate + "k", "-maxrate " + iBitrate + "k", "-b:v " + iBitrate + "k", "-c:a libvorbis", this.outputFile.getAbsolutePath());

A sample output I got:

Unrecognized option 'i D:\Noneatme\Dokumente\AAAAAAAAAAAA\day.mp4'.
Error splitting the argument list: Option not found

I never said "i" or anything like that, am I doing something wrong?


回答1:


Remove the space after -i in the 2nd parameter of the ProcessBuilder constructor, and make this.inputFile.getAbsolutePath() the 3rd parameter to the ProcessBuilder constructor. Don't add it to "-i". Essentially, make sure each element separated by spaces are their own arguments to the ProcessBuilder constructor.



来源:https://stackoverflow.com/questions/28074670/process-builder-wont-accept-ffmpeg-arguments

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!