Lisa Melton provides some amazing scripts that wrap HandBrake to produce high quality, portable versions of Blu-ray rips. The tools Lisa provides are written in Ruby, and they're packaged as a Ruby Gem. All the tools are cross platform, requiring only the Ruby runtime to be installed. But they do depend on external programs to get anything useful done. These dependencies are cross platform as well, but Windows has no standard package management system (de facto or otherwise), so installing these dependencies for Windows can be a bit of a pain. But it is possible! There are several ways to go about installing these tools and their dependencies, the two discussed here are to use Bash on Ubuntu on Windows (which is what we recommend for users of Windows 10), but if you have an older version of Windows you can also download Windows versions of everything that's needed.
If you're using an up-to-date version of Windows 10, you have access to "Bash on Ubuntu on Windows". This feature allows you to run command line Linux programs on Windows without using a virtual machine, and it also gives you access to Ubuntu's extensive package archives. Everything you need to run these scripts is easily installable with apt-get.
video_transcoding
. Inside of bash:
sudo apt-get update && sudo apt-get upgrade
to ensure everything's up to datesudo apt-get install ruby ffmpeg mp4v2-utils mkvtoolnix
sudo add-apt-repository ppa:stebbins/handbrake-releases
sudo apt-get update
sudo apt-get install handbrake-cli
video_transcoding
sudo gem install video_transcoding
The detect-crop
command has an optional dependency on mpv
for previewing crops. You can't launch graphical Linux apps using "Bash on Ubuntu on Windows", but it is capable of launching Windows programs; this means you can install mpv
for Windows, then use an alias to launch it from bash:
C:\bin
and add it to your pathC:\bin
echo "alias mpv=mpv.exe" >> .bashrc
.bashrc
by running source ~/.bashrc
If you have your movie files in the Windows file system (so NOT in ~userfolder/AppData/Local/lxss/home
), for example on your desktop, you have to provide the path to it via /mnt/[drive letter]/path/to/your/file/location
. You can also navigate to the folder in Explorer, then type bash in the address bar to open a bash instance to that location
In old versions of Windows 10, or in Windows 8.1 and earlier, you either don't have access to Bash on Ubuntu on Windows or the version that's there can't be used to do this. All the dependencies are available for Windows though, you just need to track them down:
ridk install
step at the end, you don't need this for video_transcoding
C:\bin
and add it to your PATHHandBrakeCLI.exe
to C:\bin
bin\ffmpeg.exe
to C:\bin
mkvpropedit
and the data\
directory to C:\bin
libmp4v2.dll
and mp4track.exe
to C:\bin
mpv.exe
to C:\bin
C:\bin
should now contain:
cmd.exe
and run gem install video_transcoding
Start
cmd.exe
Batch control can be achieved with the following .bat file:
@echo off
setlocal EnableDelayedExpansion
set work=%cd%
set queue=%work%\queue.txt
set crops=%work%\Crops
for /F "tokens=*" %%I in (queue.txt) do (
set title_name=%%~nI
set crop_file=%crops%\!title_name!.txt
if exist !crop_file! (
for /F "tokens=* USEBACKQ" %%F in (`type "!crop_file!"`) do set crop_option=--crop %%F
) else (
set crop_option=
)
call transcode-video !crop_option! "%%I"
)
It works in much the same way that Lisa's bash script works, although it does have the limitation of not being able to "resume" the queue in the way that Lisa's does. I would recommend creating a batch-transcode.bat
file in your C:\bin
folder, then you can create the necesarry file structure anywhere:
Crops\
queue.txt
In CMD you can CD
to that directory, populate the queue.txt
file then simply call batch-transcode
and it'll transcode everything in the queue
To create a queue.txt
with every mkv file in a directory you can use the following command:
for %a in (*.mkv) do echo %~fa >> queue.txt