Reputation: 1015
I have simple test class as
public static void main(String[] args) throws IOException {
String[] line = {"ffmpeg -i D:\\hadoop-video\\testVideo\\xyz.mp4 %d.png"};
Runtime.getRuntime().exec(line);
}
when I try to run this I am getting
Exception in thread "main" java.io.IOException: Cannot run program "ffmpeg -i D:/hadoop-video/testVideo/xyz.mp4 %d.png": CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessBuilder.start(Unknown Source)
at java.lang.Runtime.exec(Unknown Source)
at java.lang.Runtime.exec(Unknown Source)
at ImageTest.main(ImageTest.java:13)
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
however file is present on my windows7 machine with location
D:\hadoop-video\testVideo\xyz.mp4
i tried removing .mp4 and then run also not working . please suggest what might be wrong
Upvotes: 4
Views: 5470
Reputation: 539
Where ffmpeg.exe is installed? try to use full path to execute the ffmpeg.exe
e.g.
D:\ffmpeg\bin\ffmpeg.exe
then
String cmd[] = {"D:\\ffmpeg\\bin\\ffmpeg","-i","D:\\ffmpeg\\hadoop.mp4","D:\\ffmpeg\\img%d.png"};
Runtime.getRuntime().exec(cmd);
or
Process process = new ProcessBuilder(Arrays.asList(cmd)).start();
Upvotes: 2