Don from dirtdon.com recently lured my interest in shell scripts that makes sense to use from Alfreds actions menu. He did so by writing an amazing article with some of favorite bash scripts, that he had made specifically for Alfred. He had a fantastic script for converting video files to an Apple Tv friendly format, that I saw great potential in. I therefore tried to get the script up and running on my own machine, and in the process of doing so, I found a bug in his script. I fixed it and told him about my fix.
I have been adding some functionality to script since then, but it really took of when I contacted Don the second time. I contacted him in the search of help, I had an idea for a way to implement a progress indicator right in to Alfred, and I knew how I would implement it, but I didn’t know how to write the code. Don helped me out, and wrote the code for me. And by the help of our combined efforts we have made a working script, that in my opinion works quite well.
The script has the following feature set:
- Growl notifications
- Status updater (it shows queue data, ETA’s and percentage of completion).
- Queue support
- And removal of the old files
I’m posting this version of the script on my own site, since Don and I don’t share the need for the same feature set, so mine has some added functionality.
I hope I will inspire you as much as Don inspired me!
#Update Alfred has added support for a new extension format called… oh you guessed it .alfredextension so I thought I would update the script. As i bonus all you have to get this working on you machine now is to downlaod the script and double click it:-)

If you haven’t heard of Alfred before, go checkout his website
Hi, i can’t get it working. i downloaded the Handbrke CLI …
Can you give a more detailed instruction?
Where does the files from the handbrake DMG go?
Do i need to change something in the Script itself?
Thanks for your help!
Well Tom, as you can see, I posted an update that makes your question obsolete.
Been using this the last few days but…I’m not sure where I can find the progress of the encoding…
If you type the keyword you have assigned to the extension into alfred, all the progress information will be in the description line. (By default the keyword is atv)
I seem to be having trouble because my settings folder has a space in it. (~/Library/Application Support)
I’m trying to fix it but, my bash-fu isn’t very strong. I’ll post back here if I find a resolution.
Have you tried the new version? I added some code that finds the settings folder for you (so you don’t have to change the script).
The version I was working with was downloaded yesterday (8/24). I think that’s the latest version.
The space in Application Support was throwing errors on all the defaults and the HandbrakeCLI line. I fixed by temporarily changing the field separator. Updated Script.sh is here: https://gist.github.com/1170588
hi Andreas.
I found a distraction in your Script.sh.
it tries to write to a log file
/Users/Andreas/Library/Logs/HandbrakeCLI.log
of course it yealds a “No such file or directory”.
trying to just comment out the code that writes to the logs didn’t seem to work, and even adding my own log files (manually copied to the script folder and given 777) has no effect.
now I have
LOG=”/Users/ubi/Library/Logs/HandbrakeCLI.log”
LOG2=”/Users/ubi/Library/Logs/HandbrakeCLI_Converted.log”
and if I run the script I get
Aria:TranscodeforAppleTv ubi$ ./Script.sh ~/Downloads/Video/test_convert.avi
./Script.sh: line 32: /Users/ubi/Library/Application: No such file or directory
2011-09-24 09:41:44.564 defaults[9823:903]
The domain/default pair of (/Users/ubi/Library/Application, Support/Alfred/extensions/scripts/TranscodeforAppleTv/info) does not exist
2011-09-24 09:41:44.615 defaults[9828:903] Unexpected argument ; leaving defaults unchanged.
rm: HandbrakeCLI.log: No such file or directory
rm: HandbrakeCLI_Converted.log: No such file or directory
Your video has been transcoded to AppleTV format.
what do you think it is related to?
thanks
ubi
I have fixed and updated the plugin. Would you please redownload it and tell if it works. BTW in my experience the plugin only works if you check the silent setting in Alfred.
Hey there, You’ve done a great job. I will certainly digg it and personally recommend to my friends. I am confident they will be benefited from this web site.
Great script!
Only one question. How can i Automatically add the files to iTunes within the script?
Theoretically this gist I just made should work https://gist.github.com/1270471
I haven’t tried it, but as you can see on line 34 I changed the output folder to be ~/Music/iTunes/iTunes Media/Automatically Add to iTunes.localized/ I think this will work.
If you don’t know what to use the gist for, heres a brief how to.
1. Open the alfred settingsfolder, locate the “TranscodeforAppleTv” folder, and open the file called “Script.sh”.
if not, come back and I will see what I can do.
2. Copy all the text in the gist (https://gist.github.com/1270471) and replace the text in “Script.sh” with it.
3. Try and see if it is working
Hi again!
I tried the script and it completes without encoding.
I think it’s because it can’t create the file.