I am developing a Red5 media server application on a Mac (Dynamic Web Project in Eclipse). The app has to invoke FFMPEG to convert the video to a different format.
I added "/Applications/FFMPEG" to PATH variable by running the following command in Terminal:
echo 'export PATH=/Applications/FFMPEG:$PATH' >> ~/.profile
When I invoke FFMPEG from terminal, it works fine. However, every time I run it from Java code with:
Process p = Runtime.getRuntime().exec("ffmpeg");
p.waitFor();
I get the following error:
Cannot run program "ffmpeg": error=2, No such file or directory
I thought this might be a security limitation specific to the type of project, but even a simple Java program produces the same result. What am I missing?
Changing "ffmpeg" to full path of the application works, but I don't want to upload FFMPEG into the same directory as Red5 on a production server.
PATH
is a command prompt thing. Java knows nothing about paths.
Specify the full path (ie the absolute path) of your executable