从 Java 的 processbuilder 执行的 ffmpeg 在 Windows 7 下不会返回 [英] ffmpeg executed from Java's processbuilder does not return under windows 7
问题描述
我试图构建一个调用 ffmpeg 二进制文件的 ProcessBuilder.我的问题是调用它,它在 MacOs、Ubuntu 和 WindowsXp 下完美返回,但在 Windows7 下,waitFor() 永远不会返回.
I was trying to build up a ProcessBuilder calling the ffmpeg binary. My problem is that calling it, it returns perfectly under MacOs, Ubuntu and WindowsXp, but under Windows7 the waitFor() never returns.
有没有人在 windows 7 下有类似的经验?任何帮助将不胜感激!
Has anyone similar experience under windows 7? Any help would be appreciated!
我的命令:
ProcessBuilder pb = new ProcessBuilder( );
pb.command( "C:\\Windows\\System32\\cmd.exe", "/c", "c:\\ffmpeg\\bin\\ffmpeg.exe", "-version" );
也尝试过这些:
pb.command( "c:\\ffmpeg\\bin\\ffmpeg.exe", "-version" );
pb.command( "C:\\Windows\\System32\\cmd.exe", "/c", "start c:\\ffmpeg\\bin\\ffmpeg.exe -version" );
结果是一样的.:(
推荐答案
看起来您的进程在其 out 和/或 err 流中写入了一些内容.它们的缓冲区溢出和进程块.您应该读出并错误处理流程的流以避免这种情况.
Looks like your process writes something in its out and/or err streams. Their buffer overflow and process blocks. You should read out and err streams of your process to avoid this.
参见当 Runtime.exec() 获胜时t" 了解更多信息
这篇关于从 Java 的 processbuilder 执行的 ffmpeg 在 Windows 7 下不会返回的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!