I'm trying to create a Folder Action to transcode videos using Don Melton's scripts.

When I run the script, transcode_video complains that HandBrakeCLI is not available, but when I run the command directly from the terminal it runs fine.

Screenshot of the automator action

I'm guessing this is some kind of bash script security thing, but I'm an amateur at this game. Is there a way round this? I've had to revert to calling HandBrakeCLI directly, which is not as easy to optimise.

  • 1
    Do you have a link to "Don Melton's transcode video script" to help provide an answer to your question? I'd hazard a guess that the script is calling HandBrakeCLI but the shell which Automator used doesn't include that binary's directory path in its $PATH environment variable. – Dials Mavis Dec 28 '16 at 22:47

Two things:

  1. Fix your path. This is as simple as adding the following as your first line. I installed the scripts through gem, not git, so transcode_video is in /usr/local/bin - you'll need to set it as appropriate.

export PATH="/usr/local/bin:$PATH"

  1. Make sure you cd into the directory you want to save the files into, as a step too. Otherwise, writes them out into $HOME, which appears to be the default working directory for automator bash scripts.

My total working code:

export PATH="/usr/local/bin:$PATH"
for f in "$@"
    echo $f > /tmp/filename.txt
    cd ~/Desktop/SAmple/
    transcode-video --mp4 -v "$f" > /tmp/transcode.out

You must log in to answer this question.

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