Skip to main content
1 of 4

Converting videos in the background using automator and handbrake

I am trying to automate the process of video conversion using handbrake and automator.

Here is the script that i am using in Run Shell Script action of Automator Folder Action:

for f in "$@"
do
    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  &
done

The problem is when i manually run this script from automator it works fine but when new files are added in the folder then this script is called but videos are not converted But if i remove '&' from the end of the command then it even works with new files addition but not in hidden mode and i want it to run in hidden mode.

So if anybody can guide me about what i am doing wrong here???