A native implementation is always preferred in this guide, as native applications will be faster and less error prone.
For Windows users, lucky you, a native option is available for everything that we cover in this guide and then some. Ubuntu users have it pretty good too, depending on your needs you might be able to go native the whole way through as well. If you have greater needs, WINE or a VM works great for many of the other applications you might be interested in. MacOS isn’t too shabby either, although users will probably have to put the most effort in to get setup, as more software needs to be compiled for native use, and a VM is required for some steps (namely taking comparison screens). Luckily, macOS has great virtualization software.
WINE is a wonderful open source project that provides an implementation of the Win32 API for non-Windows systems. What that boils down to is being able to run applications designed and compiled for Windows on your non-Windows machine. Sadly, it isn’t perfect, although it is always getting better thanks to the open source community. This will be an integral tool for Ubuntu users, especially those whom wish to remux on a remote server.
VM stands for virtual machine, and it is pretty much another computer inside of your existing computer. While virtualization is not perfect, it is much better than WINE as far as compatibility goes, although performance suffers due to overhead. For Ubuntu users, I recommend VMware Workstation - it is an excellent product. MacOS users can choose between VMware and Parallels, both are great and chances are you already have one of them installed. Both offer unity mode, which will make Windows applications feel a bit more native, as well as shared folders, which will make working on an encode seamless.
For certain tools, I have marked them as either WINE and/or VM. For those marked as VM, you should refer to the Windows portion for installation or setup instructions, if any. The only exception is Dolby Media Producer Suite, which requires macOS. This is a completely optional piece of software, as there is
Windows users have 3 (well known) decryption and ripping tools available to them. Note that if you are not planning to use a physical Blu-ray as a source, you can skip this part. Otherwise, read on.
AnyDVD HD is by far the most well known, and probably the most advanced of these three tools. I would highly recommend this one over the others, although DVDFab is a good back up (and has proved capable of holdings its own against Slysoft’s tool). Download it here. I do not provide a link to a crack/trial re-setter as merely changing your system clock back to when the trial would be active is enough to re-enable the free trial.
DVDFab has two products of interests, Passkey for Blu-ray and DVDFab HD Decrypter. Passkey works just like AnyDVD HD. It has a free version and a paid version (with trial). HD Decrypter is also free, but requires you to rip to ISO, so Passkey would be preferred.
MakeMKV is not just a decrypter, but also a one shot remuxing tool. It’s not recommended to use this to create remuxes as it is known to drop frames. You can download it here. It has a 30 day trial period. Decrypted rips must be created through the software. This software is more like DVDFab’s HD Decrypter, rather than Passkey or AnyDVD HD.
Of these three, I would recommend AnyDVD HD. If that fails, then Passkey for Blu-ray.
TeraCopy is only necessary if you are using AnyDVD HD or Passkey for Blu-ray. The reason being TeraCopy offers to check your copy using CRC, which will help ensure that your rip is free of any glitches (that weren’t already on the disc). Bad rips happen more often than you think. You can download TeraCopy here. You will have to set your preferences to “Always test after copy”.
eac3to, which can be downloaded here, is the de facto tool for demuxing Blu-rays. This is a command line program, so if you are uncomfortable with CLI, either read some documentation you can find from Google, or use a GUI. I will cover the basic stuff you need to know later in the guide for CLI users. I do not offer support for GUIs.
There is no installer or anything for this, so just unzip somewhere convenient. You can add the directory containing eac3to.exe to your PATH environment variable, instructions are here. This will make using eac3to much easier. It’s recommended doing so, and the rest of the guide will assume that you did.
The latest eac3to versions still don’t have the latest FLAC(libFLAC)/DTS(libdcadec) decoder versions. You might want manually update them.
DTS-HD Master Audio Suite is the professional tool used to create DTS streams. You can download it from almost every general/software tracker.
Dolby Digital Surcode Encoder is a Dolby Certified encoder, so it will produce better results than libav. You can download it from almost every general/software tracker. There is no reason to use a macOS VM along with Dolby Media Producer Suite, unless you want TrueHD (no, you don’t).
Sony Sound Forge is another Dolby Certified encoder that will work with windows 10. You can download it from almost every general/software tracker.
Dolby Media Producer Suite requires macOS, see macOS section for details.
It is prefered you use the apple qaac encoder for commentary streams and for the main track. Download here. Download qaac_*.zip and copy the content of qaac64 folder to eac3to folder.
Editor’s note: There are 4 options for processing videos: Avisynth (Windows *32-bit), Avisynth+ (Windows 64-bit), AvxSynth (*nix 64-bit), and Vapoursynth (Cross-platform 64-bit). If you are just starting off with encoding you can try to learn and use Vapoursynth instead of any of the Avisynth derivatives. In addition to being a lot more powerful and flexible, it adds multithreading and uses python syntax. It is also completely cross-platform. The integration of python is pushing video processing in new directions, including the possibility to preview your video while processing it. You can read the documentation and get many of the same scripts mentioned in this guide from the official website. The downside is that you will be on your own for the most part; the rest of this guide won’t help with writing Vapoursynth.
You should try AviSynth+, which can be downloaded here. It’s recently updated, a has 64bit version (list of 64bit plugins), supports multithreading, deep color, and almost every AviSynth script should work with AviSynth+. Even without multithreading should be faster than regular AviSynth. More info here. If you’re going to use multithreading, download this script to plugins folder. If you don’t have 6+ core CPU, using > 2 threads will probably have a negative effect. Using multithreading helps when you have heavy script with a lot of filters. For vanilla script (source, crop, resizing) usually no need of multithreading. You should run some tests to see what is the best choice for the current situation.
AviSynth (not recommended), which can be downloaded here, is a scripting language that allows you to process videos. (be sure you get 2.6)
FFMS2, download here, provides a frame accurate source
filter for AviSynth(+). Copy FFMS2.avsi
and ffms2.dll
to AviSynth’s plugins folder, and
ffmsindex.exe
and ffms2.dll
to the eac3to folder. Note: FFMS2 versions above 2.19 could
cause out of sync for some sources.
AvsPmod, download here, allows you to preview AviSynth scripts. No installation required.
If you’re using AviSynth+, download THIS version.
Note: AvsPmod 32bit works with AviSynth/AviSynth+ 32bit, AvsPmod 64bit requires AviSynth+ 64bit.
There are two ways to go about using x264.
Download pre-built executables from videolan. Get the “clear” builds, unless you want to try out user modifications (not recommended for new users). Copy this to your eac3to folder.
You will also need to download avs2yuv here, as this will allow you to use 32-bit AviSynth with 64-bit x264. You only need this if you are using 64-bit x264 (probably most of you). Place this in your eac3to folder.
And lastly you’ll need LoRd_MuldeR’s LoggingUltil here which allows you to keep a copy of the x264 encoding log. Again, place this in your eac3to folder.
Example of a batch file to run encodes:
@echo off
avs2yuv "I:\temp\testing.avs" -o - | x264 --level 4.1 --preset veryslow --min-keyint 24 ^
--vbv-bufsize 78125 --vbv-maxrate 62500 --rc-lookahead 250 --me umh --merange 48 --direct auto --subme 11 ^
--no-dct-decimate --no-fast-pskip --deblock -3:-3 --qcomp .6 --aq-mode 1 --aq-strength 1 --ipratio 1.4 ^
--pbratio 1.3 --no-mbtree --psy-rd 1 --bframes 16 --crf 15 -o 1080e.mkv --demuxer y4m - 2>&1 | ^
LoggingUtil.exe --regexp-skip "(indexing|\d+/\d+ frames)" : #STDIN#
Example of a batch file to run encodes with AviSynth+ 64bit and x264 64bit:
@echo off
x264 --level 4.1 --preset veryslow --min-keyint 24 --vbv-bufsize 78125 --vbv-maxrate 62500 ^
--rc-lookahead 250 --me umh --merange 48 --direct auto --subme 11 --no-dct-decimate ^
--no-fast-pskip --deblock -3:-3 --qcomp .6 --aq-mode 1 --aq-strength 1 --ipratio 1.4 ^
--pbratio 1.3 --no-mbtree --psy-rd 1 --bframes 16 --crf 15 -o 1080e.mkv "input" 2>&1 | ^
LoggingUtil.exe --regexp-skip "(indexing|\d+/\d+ frames)" : #STDIN#
Simple x264 Launcher is precisely what its name implies, and is my personal pick for GUI. You can download it from here. It includes x264 and avs2yuv.
MKVToolNix is a suite of tools for processing matroska files, most importantly, it is what we will use to combine our demuxed streams into one single and easy to use file. You can download it from here. It does not matter if you use the installer or the portable version.
Ubuntu users have the fewest options available for disc decryption. The only tool I know of is MakeMKV, which you will have to build yourself. The source and build instructions can be found here.
If you want to use AnyDVD HD or DVDFab, using a VM works great. VMware is capable of passing your optical drive through to the guest OS.
Server users will have to use WINE. VM users can choose to use their VM instead. eac3to compatibility with WINE is very good, however.
To install WINE:
sudo apt-get update && sudo apt-get upgrade && sudo apt-get install wine
To get eac3to:
cd ~
mkdir eac3to && cd eac3to
wget http://madshi.net/eac3to.zip
which unzip || sudo apt-get install unzip
unzip eac3to.zip
Let’s setup some handy aliases to make using eac3to easier. Add these to .bashrc or .bash_aliases.
alias eac3to='wine ~/eac3to/eac3to.exe 2>/dev/null'
alias eacout='wine ~/eac3to/eac3to.exe 2>/dev/null | tr -cd "\11\12\15\40-\176"'
While we’re at it, let’s install mono so we can use BDInfo: GUI REQUIRED
winetricks mono210
I have been rather unsuccessful getting this to run with WINE, although others have had different experiences, so YMMV.
Similarly for Dolby, a VM is going to be your best bet.
libfdk_aac
/ ffmpeg AAC EncoderYou will have to choose between the two different AAC encoders readily available on Linux.
They are libfdk_aac
and ffmpeg’s native AAC encoder.
According to the ffmpeg docs:
This encoder [libfdk] is considered to produce output on par or worse at 128kbps to the the native FFmpeg AAC encoder but can often produce better sounding audio at identical or lower bitrates and has support for the AAC-HE profiles.
Since we will be mostly encoding audio at a higher bitrate than 128kbps, most readers will only need the native encoder.
sudo apt-get install ffmpeg
In case you want to use libfdk_aac
anyway,
here is a script for compiling ffmpeg with libfdk_aac
.
While there are an abundance of methods of SUP OCR on Windows, I have found only a couple for Ubuntu, here’s my pick.
To “demux” our PGS SUP streams into timings and bitmaps, we are going to use BDSup2Sub++, a C++ and Qt port of the original BDSup2Sub tool for Java. Using this, we can convert the SUP into BDN XML + PNG, which we will be able to properly process.
You will need to install Qt and Qxt.
sudo apt-get install qt4-dev-tools qt4-qmake qt4-qtconfig libqxt-dev
Now download the source for BDSup2Sub++ from GitHub and compile.
cd ~
git clone https://github.com/amichaelt/BDSup2SubPlusPlus.git
cd BDSup2SubPlusPlus/src
qmake
make
You will be left with a bdsup2sub++ binary in the current working directory. You can
“install” it if you wish with sudo cp bdsup2sub++ /usr/bin
Additionally, we need an OCR tool to convert the images to text, so we will use tesseract for
that. Install it via sudo apt-get install tesseract-ocr
You can get training data for various languages from aptitude as well, search for them with
apt-cache search tesseract-ocr-
and then install as usual, e.g. to get Spanish data: sudo apt-get install tesseract-ocr-spa
Now you have the tools you need for bdnxml2srt, which is a script that will OCR all the images for you, as well as convert the XML timings to SRT timings. Download here.
Please read the editor’s note regarding Avisynth/Avxsynth.
AvxSynth with FFMS2 support is going to be our native alternative to Avisynth, which will allow us to manipulate video streams. This is where things get a bit more complicated, as you’ll have to compile some things from source. Just follow the instructions and you should be good.
First, we’ll need to get some build tools and dependencies.
sudo apt-get install git autoconf automake build-essential libgpac-dev \
yasm libtool pkg-config texi2html zlib1g-dev checkinstall subversion \
liblog4cpp5-dev liblog4cpp5 libcairo2-dev libpango1.0-dev libjpeg-dev \
python-wxgtk2.8
FFMS2, which stands for ffmpegsource2, is obviously going to depend on FFmpeg, so we need to build that first.
cd ~
mkdir ffavx_build
git clone --depth 1 https://git.ffmpeg.org/ffmpeg.git ffmpeg
cd ffmpeg
./configure --prefix=$HOME/ffavx_build --enable-gpl --enable-version3 \
--enable-avresample --enable-pic --disable-encoders --disable-muxers \
--disable-debug --disable-network --disable-hwaccels --disable-indevs \
--disable-outdevs --disable-filters --disable-devices
make
make install
Now we can build FFMS2.
cd ~
git clone https://github.com/FFMS/ffms2.git
cd ffms2
PKG_CONFIG_PATH=$HOME/ffavx_build/lib/pkgconfig ./configure \
--enable-shared --enable-static --with-pic
make
sudo checkinstall --pkgname=ffms2 --pkgversion="1:$(./version.sh)-svn" \
--backup=no --deldoc=yes --fstrans=no --default
sudo ldconfig
And finally, AvxSynth, with FFMS2 support.
cd ~
git clone --depth 1 https://github.com/avxsynth/avxsynth.git
cd avxsynth
autoreconf -fiv
PKG_CONFIG_PATH=$HOME/ffavx_build/lib/pkgconfig ./configure \
--enable-silent-rules
make
sudo checkinstall --pkgname=avxsynth --pkgversion="1:$(grep "Version" \
avxsynth.pc | cut -f2 -d " ")+$(git rev-list HEAD | wc -l)-$(git \
rev-list HEAD -n 1 | cut -c 1-7)-$(date +%Y%m%d)" --backup=no \
--deldoc=yes --fstrans=no --default
The wonderful developers of AvsPmod have added support for linux and AvxSynth.
cd ~
wget https://github.com/AvsPmod/AvsPmod/archive/v2.5.1.zip
unzip v2.5.1.zip
cd AvsPmod-2.5.1
python run.py
Consider creating an alias for the final command to make things easier in the future, and don’t forget to use the absolute path to run.py when you do.
cd ~
git clone --depth 1 https://git.videolan.org/git/x264.git
cd x264
wget http://media.xiph.org/video/derf/y4m/akiyo_qcif.y4m
PKG_CONFIG_PATH=$HOME/ffavx_build/lib/pkgconfig ./configure \
--enable-static --extra-cflags="-march=native"
make fprofiled VIDS=akiyo_qcif.y4m
sudo make install
make distclean
After running the above configure script, your output should look like below. Note also that if
you want a 10-bit version of x264, append --bit-depth=10
to the ./configure line. If you are
curious as to what fprofiled does, it basically performs optimization based on real world usage
of x264. The video we optimize with is arbitrary.
When it is time to update x264, just git pull
followed by the same commands we used above.
platform: X86_64
system: LINUX
cli: yes
libx264: internal
shared: no
static: yes
asm: yes
interlaced: yes
avs: avxsynth
lavf: yes
ffms: yes
gpac: yes
gpl: yes
thread: posix
opencl: yes
filters: resize crop select_every
debug: no
gprof: no
strip: no
PIC: no
visualize: no
bit depth: 8
chroma format: all
MKVToolNix is a suite of tools for processing matroska files, most importantly, it is what we will use to combine our demuxed streams into one single and easy to use file. Official installation instructions for MKVToolNix can be found on the official site located here.
DVDFab has two products of interests, but only one of them has a macOS version. DVDFab HD Decrypter is free, but requires you to rip to ISO.
MakeMKV is not just a decrypter, but also a one shot remuxing tool. It’s not recommended to use this to create remuxes. You can download it here. It has a 30 day trial period. Decrypted rips in this case are BDMV. It seems that by default, making a full disc backup does not remove encryption, you’ll need to check the box for that.
Since a VM is required for macOS users, I would recommend using eac3to in a VM as well, but if you want WINE anyways, I’ll go over that too. If you go the VM route, be sure to do the decoder setup as well.
Even if you don’t want to use WINE, you should still do the following as you’ll need it for other things.
Download and install XCode from the App Store. Once installed, launch it, and accept the user agreement. In the menu bar, go to XCode > Preferences, go to the Downloads tab, and install Command Line Tools. We will also need XQuartz. Download it from here and install.
Skip below if you don’t want WINE.
We are going to use macOS WINE, rather than homebrew/macports/etc, as this script is self contained, and won’t break anything else later.
Download eac3to here, and unzip to your home
directory (only because the rest of the instructions assume so), such that you have
~/eac3to/eac3to.exe
While we’re at it, let’s install mono so we can use BDInfo:
winetricks mono210
Add these two aliases to .bashrc or .bash_aliases (if enabled).
alias eac3to='wine ~/eac3to/eac3to.exe 2>/dev/null'
alias eacout='wine ~/eac3to/eac3to.exe 2>/dev/null | tr -cd "\11\12\15\40-\176"'
Be sure to use the correct paths to wine and eac3to.exe for your system.
I have been rather unsuccessful getting this to run with WINE, although others have had different experiences, so YMMV.
Finally, macOS has the best native solution for something. Download Dolby Media Producer Suite from somewhere. There is no reason to use Dolby Digital Surcode Encoder in a VM.
While there are an abundance of methods of SUP OCR on Windows, I have found only a couple for macOS, here’s my pick.
To “demux” our PGS SUP streams into timings and bitmaps, we are going to use BDSup2Sub++, a C++ and Qt port of the original BDSup2Sub tool for Java. Using this, we can convert the SUP into BDN XML + PNG, which we will be able to properly process.
Download a pre built version of BDSup2Sub++ from
doom9 (doom9 should have the latest
link). You are interested in the file Contents/MacOS/bdsup2sub++
. You should leave it
there as it needs access to the Resources included in the package. However, this means
more typing in the future, unless you set an alias.
Additionally, we need an OCR tool to convert the images to text, so we will use tesseract for
that. brew install tesseract
If you want to use language training data not included with the homebrew package, download the appropriate training data, open it with Finder, and copy the .traineddata file into the /usr/local/Cellar/tesseract/version/share/tessdata directory.
Now you have the tools you need for bdnxml2srt, which is a script that will OCR all the images for you, as well as convert the XML timings to SRT timings. Download here.
Please read the editor’s note regarding Avisynth/Avxsynth.
We are going to use homebrew to get some more essential tools (testing with MacPorts resulted in failure).
brew doctor
brew install yasm nasm texi2html automake autoconf libtool pkg-config
Now we can start building.
cd ~
git clone --depth 1 https://git.ffmpeg.org/ffmpeg.git ffmpeg
cd ffmpeg
./configure --prefix=/usr/local --enable-gpl --enable-version3 \
--enable-avresample --enable-pic --disable-encoders --disable-muxers \
--disable-debug --disable-network --disable-hwaccels --disable-indevs \
--disable-outdevs --disable-filters --disable-devices
make
make install
Get FFMS2 by running brew install ffms2
Now to build AvxSynth.
cd ~
brew install log4cpp cairo pango
git clone --depth 1 https://github.com/avxsynth/avxsynth.git
cd avxsynth
autoreconf -fiv
PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/X11/lib/pkgconfig \
./configure --prefix=/usr/local --enable-silent-rules
make
make install
While Ubuntu users have native support for running AvsPmod, macOS users do not, sadly. The devs will have to update it with macOS support. Until then, you’ll need to use a VM for this.
The best way to install x264 on macOS is with Homebrew.
cd ~
git clone --depth 1 https://git.videolan.org/git/x264.git
cd x264
brew install wget
wget http://media.xiph.org/video/derf/y4m/akiyo_qcif.y4m
MKVToolNix is a suite of tools for processing matroska files, most importantly, it is what we will use to combine our demuxed streams into one single and easy to use file. You can download it from here.