运行调用Runtime.getRuntime()。EXEC()输出从执行命令行程序不同直接
/usr/bin/mediainfo --Inform='Video;%Duration%' /home/daniel/upload/videos/4/f/6/e/f/4f6ef2e0d67c4.flv
从终端给我此输出
并运行这在java
Process p1;
try {
p1 = Runtime.getRuntime().exec("/usr/bin/mediainfo --Inform='Video;%Duration%' /home/daniel/upload/videos/4/f/6/e/f/4f6ef2e0d67c4.flv");
BufferedReader input1 = new BufferedReader(new InputStreamReader(p1.getInputStream()));
String line1;
while ((line1 = input1.readLine()) != null) {
System.out.println("-"+line1);
}
input1.close();
p1.waitFor();
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
个
结果
-General
-Complete name : /home/daniel/upload/videos/4/f/6/e/f/4f6ef2e0d67c4.flv
-Format : Flash Video
-File size : 62.0 MiB
-Duration : 15mn 3s
-Overall bit rate : 576 Kbps
-Tagging application : Yet Another Metadata Injector for FLV - Version 1.4
-
-Video
-Format : AVC
-Format/Info : Advanced Video Codec
-Format profile : [email protected]
-Format settings, CABAC : Yes
-Format settings, ReFrames : 4 frames
-Codec ID : 7
-Duration : 15mn 3s
-Bit rate : 512 Kbps
(much more here) ...
我如何得到我的调用Runtime.getRuntime所需的输出(903520),()。EXEC(CMD)?
编辑:固定格式
提示 - 在发布前检查你的问题在预览窗口。这格式不会看起来很健康,我... –
对此深感抱歉... – daker
不知道太多关于什么'在/ usr/bin中/ mediainfo'呢,是不是清楚你如何参数必须被解释引起第二组输出?这似乎特别奇怪,如果它通常会输出一个六位数字。 –