I am trying to automate video conversion process using Automator and Handbrake CLI version. I am trying to implement the functionality that whenever a video is downloaded in my dropbox folder on my PC it is converted and put in another folder. Currently i am testing it with a test folder (not on dropbox so i am just copying files to it to test). When a put a single file or multiple files in the folder simultaneously it works. But when i put one file (or many) and script is executing i.e. converting the videos and i put another file in the folder then for that new file script is never called so the new video is not converted.

So how can i achieve this functionality that when script is running and new file is added another instance of script is started for new file.

And also the new file is saving with only the first word in the name if name has many words (i.e. breaking on space)

Here is the screenshot of my automator configuration:

Automator Image

Thanks in advance for your help.

Here is my script from run shell script as you asked @:Tony Williams

for f in "$@"
    Applications/HandBrakeCLI -i "$f" -t 1 --angle 1 -c 1 -o "/Users/abc/Desktop/TestVidDest/$(basename $f)"  -f mp4  -4  -O  --decomb="fast" -w 1280 -l 720 --modulus 16 -e x264 -b 3800 -2  -T  --cfr -a 1 -E faac -6 dpl2 -R 48 -B 128 -D 0 --gain 0 --audio-fallback ffac3 --x264-preset=slow  --x264-profile=high  --x264-tune="film"  --h264-level="4.0"  --verbose=1
  • It's almost impossible to read that shell script step. Could you paste just the text into your question? Commented Jan 21, 2014 at 11:59
  • Most likely the problem is with Automator not getting triggered by new files, not with the shell script. To test that, can you replace the content of the for loop with sleep 30 && mv "$f" /tmp and see whether all files get copied or only the ones you put in first?
    – nohillside
    Commented Jan 21, 2014 at 12:25
  • 1
    @patrix thanks for your reply! same problem here too. it works if i put files and then wait for them to move and then put new files. but not works when i put some files and while they are being moved (i.e. script is running) i put some more files then the new files are not moved. Commented Jan 21, 2014 at 12:45
  • When using folder actions the for i in "$@" ... should be obsoleet... Commented May 20, 2015 at 17:45

3 Answers 3


Process in the background

Ideally, your script needs to complete as quickly as possible. The easiest way is to spin off the processing of the movies into background processes. You can do this by adding a space and an ampersand & to the end of your HandBrakeCLI line.

Move before processing

However, this does not solve the problem of new files being ignored. In fact, your files could now be processed twice if the processing is not finished before the next new file appears.

Your script should move each new file to another unmonitored folder before processing begins. Consider adding a mv command before your HandBrakeCLI line. Alternatively, you could have Automator perform the move.

The destination folder should ideally be on the same drive, so it completes quickly and does not delay the script.


I highly recommend Don Melton's (former Apple Safari chief) transcode-video script for converting video files. The topic and script are covered in depth on iMore's Vector podcast, episode 22.

To automate, the script could be wrapped in a Folder Action, or see Don's Gist comment (24 Jun) on how he does batch transcodes.


Also keep in mind that there was/is HandBreakeBatch which like the name indicates is meant to do batch processing HandBreak.

But as the Developer says on its Website http://www.osomac.com/2013/08/08/handbrake-adds-real-batch-processing/

Habdbreak now should Support Batch processing by them selfes.

You must log in to answer this question.

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