Running FFMPEG in Automator

automatorffmpegshell

I have this simple command.

for f in "$@";
do 
ffmpeg -n -i  "$f" -ss  00:00:0.123 -f image2 -vframes 1 /Volumes/Media\ Archs/FrameGrabs/yosemite.png
ffmpeg -n -i  "$f" -vf  "select=gt(scene\,0.049)" -vsync vfr  /Volumes/Media\ Archs/FrameGrabs/yosemiteThumb%03d.png
done

Works in shell file, but when I run this through automator, it produces.

The action “Run Shell Script” encountered an error: “-: line 4: ffmpeg: command not found
-: line 5: ffmpeg: command not found” ```

What am I doing wrong? 

Best Answer

In order to run an application directly without writing the whole path to the program executable, it has to be added to the $PATH environment variable. As you can run the command when you do it manually, I assume that you did that. But as it does not work when using automator, I would conclude that automator does not look into the $PATH.

In order to get it working, I would suggest to write the whole path in the script and try it again. Then there should be no problems to „find the command“ so that the given error message will no longer be displayed.

Related Question