Sep 20 2012

Using HandBrake to batch convert videos to Roku

fyci5dw1_thumb Using HandBrake to batch convert videos to Roku

It’s been about three months since I picked up my Roku.  From that point, it’s been a roller coaster ride finding all kinds of new stuff to do with it. one of the most exciting things I found that I could do with the Roku [w/Plex] was to be able to play the DVD ISOs that I had in my digital library.  Being able to play the ISOs and not having to convert those files into another format was a huge plus, but I found a few little quirks with playing some ISOs. 

For some reason, some ISOs didn’t work correctly, or what play at all were sometimes I would find that the movie would stop playing for some reason and the Roku doesn’t have a clear resume function to start playing the movie the previous spot. again, I was using my Roku with the Plex channel.  So it’s not so much the Roku, but more of the abilities of the Plex application/channel.

Then I started looking at a lot of the other family videos that I had in my library and then that’s what really hit me that I need to make sure that all these videos are in the same format so that if I want to, I can play these videos through Roku without any problems, or if I decide to switch to another streaming player [ which I may do]   the video format that I go to need to be widely compatible;  speaking mainly to the MP4 format.

I have a decent video library of DVD ISOs, mainly because my son likes to destroy his children’s movies.  I have personally purchased transformers movies at least two or three times, all of them.

If you’ve ever converted videos before, you know that it’s a time-consuming process.  So it makes more sense to place all of your existing videos into one folder and then have an application just dig through that folder and convert everything in it to the format that you want. and it’s also convenient if you can schedule this type of function to happen in the middle of the night while you’re sleeping,  because converting data can also consume a lot of your processing power on your PC, making it really difficult to be productive in just about anything that you’re going to do.

This is when I came to the realization that I needed something to convert my videos in a batch… and I love using HandBrake to convert my videos;  it simply awesome. I haven’t found anything yet that can defeat it.

umb3rmuc_thumb Using HandBrake to batch convert videos to Roku

It’s a free application and it has the option to accept command line functions; exactly what you need if you going to be doing batch functions.

But I also needed something that was flexible enough that I could use to build  a list of items to process.  Enter autohotkey. Autohotkey is another application/scripting language that I absolutely love.  It’s very flexible, it has a lot of abilities and it can save you tons of time in doing repetitious functions.

I already had handbrake application to convert videos,  but I needed something to create the process list.

I went digging through the autohotkey support forums and found a script that someone had already been working on.  When I grabbed it, it didn’t do exactly what I wanted to, but the beauty to autohotkey is that you can change the scripts have them do what you want to do;  how you want them to do them.

I’m not taking credit for the script, because I didn’t write it;  I modified it.  All the credit for writing the original script  should go to the author… But here’s the autohotkey script that I use to convert my videos to MP4…


; AutoHotkey Version: 1.x
; Language:       English
; Platform:       Win9x/NT
; Author:         A.N.Other <>
; Script Function:
;    Template script (you can customize this template by editing "ShellNewTemplate.ahk" in your Windows folder)

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

#SingleInstance, Force

Originalsfolder=C:DVDRipOriginal ISOs
Convertedfolder=Z:ConvertedNot sorted

Traytip, %progname%, Loaded…

FileExt = MP4|ISO|AVI|ASF|WMV ; file extension pattern

SetTimer, Watchmen, 1000 ; check every 5 secs

If FileExist("*.mp4") || FileExist("*.ISO")|| FileExist("*.avi")|| FileExist("*.ASF")|| FileExist("*.WMV") ; ... for the existense of mpgs and/or avis
    Loop, *.* ; go and get'm
        SplitPath, A_LoopFileLongPath, OutFileName,,, OutNameNoExt ; get file details
        If InStr(FileExt,SubStr(A_LoopFileName,-2)) ; if file extension exists within our pattern
            TrayTip, %progname%, Processing: `n %OutFileName% ...
                 "C:Program Files (x86)HandbrakeHandBrakeCLI.exe"
                 -i "%OutFileName%"
                 -o "%convertedfolder%%OutNameNoExt%.mp4"
            Filemove, %OutFileName%, %originalsfolder%,1
            TrayTip, %progname%, Moved: `n %OutFileName% ...
            sleep, 3000
    msgbox, Nothing was found to process.


The autohotkey script,  as it’s presented here,  is to be placed into the directory where the videos are that are supposed to be converted.  I wanted to make sure that once I converted my original files, that I placed those original files into a separate folder so that I knew that they were processed,  and I wanted to place the converted files into a separate folder showing that they were converted.  In my case, I was dropping them directly into my Plex folder.

Understanding that some people may not want to do the same thing that I’m doing, people are welcome to change the originals folder  and the converted folder as needs be, or take the script entirely and convert it to our you want to do it.

With this particular script, you can call out the profile that you want to use with handbrake, using the preset option in the autohotkey script.  If you want to use your custom profile, simply open handbrake, create a new video profile and save it.  come back to the script,  just the preset name and your set.

Again, you can take this autohotkey script,  uses scheduling program and run the batch conversion program in the middle of the night where it’s most convenient,  but when the script doesn’t find anything else in the folder process it exits.

By converting all my videos to MP4, I can enjoy my entire movie collection and if something happens during the playback of the movie, I now have the ability to resume viewing the video; something that I wasn’t able to do with Plex.

I also found that this is really helpful in converting videos to MP4 before uploading them to YouTube.  The conversion method used in handbrake under the normal profile seems generically and overall and all round good balance of size and quality. There’s no need in uploading  100 MB of data when you only have to upload 50 MB of converted data, that’s been optimized.

I hope this helps…


Thank you,
Larry Henry Jr.

Support the site — Share this!