我有以下代码:
ProcessBuilder builder = new ProcessBuilder("C:\\file\\ffmpeg.exe", "-i", src);
builder.redirectErrorStream(true);
Process process = builder.start();
InputStream is = process.getInputStream();
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
try {
while ((br.readLine()) != null) {
System.out.println(br.readLine() + "\n");
}
} catch (IOException e) {
e.printStackTrace();
}
现在这是输出:
使用 gcc 4.7.2 (GCC) 于 2013 年 3 月 22 日 08:56:38 构建
libavutil 52. 22.101 / 52. 22.101
libavformat 55. 0.100 / 55. 0.100
libavfilter 3. 48.100 / 3. 48.100
libswresample 0. 17.102 / 0. 17.102
输入 #0,avi,来自 'C:\Users\Olle\Desktop\file.avi':
编码器:Lavf52.104.0
流 #0:0:视频:mpeg4(简单配置文件)(DX50 / 0x30355844)、yuv420p、720x408 [SAR 1:1 DAR 30:17]、29.97 fps、29.97 tbr、29.97 tbn、30001 tbc
必须至少指定一个输出文件
当它应该输出更多(在常规命令行中输出更多)。
I don't understand what is going on. The weird thing is that when I compile the above code on Mac, it works fine. It's only in Windows I have this issue.
Even with:
String line = null;
try {
while ((line = br.readLine()) != null) {
line = br.readLine() + "\n";
}
Same issue...