Using Imagemajick in java using OS X
I have imagemajick installed in OS X using macports. When I run a convert command from the command line (bash) I am able to convert my movie to a jpg. But when I run it via the Java Process Builder I get no such output. What gives. The following is the java code I use to execute the command.
private void run(String[] args)
{
try
{
ProcessBuilder pb = new ProcessBuilder(args);
开发者_Python百科 Process p = pb.start();
p.waitFor();
InputStream is = p.getInputStream();
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
String line;
while ((line = br.readLine()) != null)
{
System.out.println(line);
}
is = p.getErrorStream();
isr = new InputStreamReader(is);
br = new BufferedReader(isr);
while ((line = br.readLine()) != null)
{
System.err.println(line);
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
The string passed in is /usr/local/bin/convert /Users/me/Videos/Capture-20110708-220220.mpg[0] /Users/me/Videos/out0.jpg
You might try redirectErrorStream()
, as shown in this related example, to see any diagnostic output.
精彩评论