I have just compiled my own copy of ffmpeg on my system and it's located in the following path:
/opt/local/bin/ffmpeg
When I run the following command in Terminal.app, it runs smooth:
ffmpeg -i /Users/Amit/Documents/input.avi -c:v copy -c:a aac -b:a 384k -strict -2 /Users/Amit/Documents/output.m4v
However, a similar command run as a shell-script in an Automator service fails:
for f in "$@"
do
ffmpeg -i "$f" -c:v copy -c:a aac -b:a 384k -strict -2 "${f%.*}.m4v"
done
Up until now, I had a pre-compiled build of ffmpeg on my system located at:
/Applications/Scriptlets/
And my Automator shell-script had the full path (/Applications/Scriptlets/ffmpeg) instead of just ffmpeg; and it worked fine. However, today I decided to compile a fresh copy of ffmpeg using MacPorts and removed the earlier version from my Applications/Scriptlets folder. Now, this ffmpeg works fine in Terminal but gives an error whenever I try running it from a shell-script inside of an Automator workflow. Am I doing something wrong here? Please help!