gpt4 book ai didi

java - 无法将命令参数传递给 Java 调用的外部 .exe 应用程序

转载 作者:行者123 更新时间:2023-12-04 23:32:42 25 4
gpt4 key购买 nike

关闭。这个问题是not reproducible or was caused by typos .它目前不接受答案。












此问题是由拼写错误或无法再重现的问题引起的。虽然类似的问题可能是 on-topic在这里,这个问题的解决方式不太可能帮助 future 的读者。


5年前关闭。







Improve this question




我正在尝试从 java 调用本地 ffmpeg.exe 来合并视频和音频文件。

下面的 windows cmd 脚本工作正常

c:\users absPathOf ffmpeg.exe  -i absPathOf video.mp4 -i absPathOf audio.mp4  ouput.mp4

但是在java中传递参数时遇到问题,在下面尝试过,但不起作用
    Process process = new ProcessBuilder(absPathOf ffmpeg.exe,-i absPathOf video.mp4,-i absPathOf audio.mp4,outPut).start();

我很确定 ffmpeg.exe 已经启动,但只是没有我通过的参数

另外,我的路径字符串如下所示,我尝试了“/”、“\”、“\”的分隔符
似乎没有任何区别
F:\\ffmpeg-20160912-bc7066f-win64-static\video.mp4

我检查了旧问题,没有找到有用的解决方案,有人可以帮忙吗? tks

最佳答案

尝试分别传递每个参数

Process process = new ProcessBuilder(absPathOf ffmpeg.exe,-i, absPathOf video.mp4,-i, absPathOf audio.mp4,outPut.mp4).start();

希望能帮助到你。

关于java - 无法将命令参数传递给 Java 调用的外部 .exe 应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39468574/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com