3

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!

  • What type of project are you working on? – les Jun 29 '15 at 4:17
6

The Automator script does not automatically share your Terminal.app profile. Paths to additional tools may not be found because Automator's script can not find them.

Try expanding your script to include the absolute or full path to the ffmpeg you want to use:

for f in "$@"
do
    /opt/local/bin/ffmpeg -i "$f" -c:v copy -c:a aac -b:a 384k -strict -2 "${f%.*}.m4v"
done

Alternatively, bring in your Terminal.app profile using the approach to this question, My Automator Workflow fails because it fails to find the git command within the 'Run Shell Script' command? Need help.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .