Running
/usr/bin/mediainfo --Inform='Video;%Duration%' /home/daniel/upload/videos/4/f/6/e/f/4f6ef2e0d67c4.flv
from terminal gives me this output
903520
And running this in 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();
}
Results in
-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) ...
How do I get my desired output (903520) from Runtime.getRuntime().exec(cmd) ?
edit: fixed formatting
/usr/bin/mediainfodoes, is it clear to you how the arguments must have been interpreted to cause the second set of output? This seems especially weird if it would usually simply output a six-digit number.echoin front of theRuntime.getRuntime().exec()command line and share the captured results? In that way, we can determine if the two command lines really are the same, as you think they are. If they are the same, we'll check the environment next. I suspect that the issue is that%Duration%is not being expanded as it would in a "n