Handbrake video encoder: A five minute guide to mastery

Handbrake is a tool that converts almost any video format out there to a selection of modern, widely supported codecs.

You can generally open almost any video formats including disc-based formats like DVD and Blu-ray.

It uses Libav which is a library which enables handling of multimedia data.

This library supports pretty much all common operating systems meaning Handbrake also supports most common operating systems.

Table of Contents

  1. Getting Started
  2. A Quick overview of the Handbrake UI
  3. Work Flow
  4. Using Queues
  5. Point to point encoding
  6. Adding subtitles
  7. Video settings
  8. Upscaling
  9. Picture Settings
  10. Surround Sound
  11. Handbrake CLI
  12. Encoding Speed
  13. Squeezing Videos
  14. Ripping Copyrighted DVDs with Handbrake
  15. Overview of Encoding formats and Video Containers

Getting Started

Download and install Handbrake.

This tutorial is based on Handbrake 0.99 on Debian Linux.

Launch Handbrake by clicking twice on its icon, depending on the system settings one single click might suffice.

You should get something like:

Handbrake

Quick overview of the handbrake UI

Handbrake’s most common functions can be accessed via the toolbar.

Handbrake ToolBar

The Open Source button should allow you to select the video you already have that you want to convert to another format. Dragging and dropping the video into Handbrake’s main window should also do the trick.

The fields in the Presets values should then become active. This offers additional dialog which relates to the output video properties.

Dragging and dropping the video into Handbrake’s main window should also do the trick. The fields in the Presets values should then become active. This offers additional dialog which relates to the output video properties.

In the event that your source contained more that one source video, Handbrake offers a way to select which video clip you want to use by the title menu drop down menu.

Handbrake Title drop down

There’s also an add to queue button that comes in handy when you want to convert many videos.

Handbrake add to queue

Handbrake also offers a list of Presets. A Preset is basically a set of output video properties which are optimized for particular common devices. For instance, the Devices drop down list contains presets for common devices including the iPod, iPad and AppleTV.

Handbrake Presets

The Windows version of Handbrake contains a lot more pre-made Presets which covers pretty much most of the common devices.

Workflow

Handbrake’s default settings and most of the official Presets use a constant quality encoding method which is supposed to make your new video look consistent from start to finish. It’s advisable to use the contrast quality unless you have a specific reason not to.

Increasing your output video quality will make your video take up more disk space or on your playback device while reducing quality will make it take up less space.

The recommended settings for x264(which is the default on Handbrake. Presets) is RF 18 – 22 for Standard Definition, 19 – 23 for High Definition, RF 20 – 24 for Full High Definition and 22 – 28 for Ultra High Definition.

Drastically low-quality settings will show significant loss of detail on output videos.

After making all the needed customization to the Preset you can now preview your video using the View -> Preview menu.

Handbrake Preview

In case you have made many changes to the current Presets and wish to save them, you can create a new preset from the Preset -> Save menu. Handbrake will then use the default behavior rules you’ve set and any settings from the main window just before you pressed Save.

Using Queues

For more complicated workflow, you can use Handbrake’s queuing feature to configure multiple conversions(since conversions take long and consume a lot of computational power).

Add sources to the queue using the Enqueue button. You can remove jobs from the queue by selecting the X button next to the unwanted job.

Handbrake edit queue

You can edit the preset for a particular video clip in the queue by selecting the clip and clicking the edit button at the top left of the queue. This will edit the output video properties of the current video clip without interfering with the output video properties of the other video clips in the same queue.

Handbrake edit job

When ready, select the Start button on the Queue window or on the toolbar.

Point to point encoding

Another handy feature in Handbrake is a point to point encoding whereby you may want to encode part of a video instead of the whole video. This can be done from the drop down menu which contains ‘chapters’ by default. Chapters only relate to when you’re decoding from a DVD or a Blu-ray disc.

Also present is a drop down menu that offers for both ‘seconds’ and ‘frames’. For instance, shown below is Handbrake with a video of length 1 minute 8 seconds selected. On the manually select portion of the video will be encoded.

Handbrake point to point options

Adding Subtitles

Handbrake does not store Audio and Subtitle tracks in Presets. Instead, behavior rules for automatically selecting audio and subtitle tracks each time you scan a new source or select a title are stored.

To configure the track selection behavior, navigate to the “Subtitle Defaults” tab each time you scan a new source or select a title.

Handbrake Subtitle Defaults

Add subtitles to the list via the “Subtitle List” tab. You can either have the subtitles in the same folder as your source or you can use the Add button and locate the subtitle file.

handbrakeaddsubtitle

Video settings

The video settings tab is located on Handbrake’s main window and becomes active after you’ve scanned a source. These are settings you use to manage the video properties of the output.

Handbrake Video Dialog

Another spectacular setting is the ‘web optimized’ only available when converting to MP4. It functions to place the MP4 container header at the start of the file. MP4 files consist of chunks of data called atoms which could be generally termed as subtitles or chapters.

MP4 files consist of chunks of data called atoms which could be generally termed as subtitles or chapters.

On normal occasions, a “table of contents”, which contains information related to subtitles and metadata relating to the video and audio chunks in stored in an unspecified location with the file.

In cases where you have the whole MP4 file finding this “table of contents” is easy but in cases where you are streaming a video, it becomes hard since you don’t have the whole file. A problem which can be solved by modifying MP4 files to that the “table of contents” chunk of the video is located in the first part of the container.

This problem is solved by modifying MP4 files so that the “table of contents” chunk of the video is located in the first part of the container.

This allows for minimal bandwidth usage and less time wasting.

Upscaling

Upscaling refers to a situation whereby you want to convert a lower resolution video to a higher resolution video. It is barely ever necessary.

Handbrake GUI doesn’t allow for upscaling but upscaling can be done via the command line interface with the -width and -height options.

You might, for instance, have a broken hardware scaler on the viewing device but still want to utilize its maximum resolution. This is one of the few cases you might want to use Handbrake’s upscaling feature.

Picture settings

Picture settings allow for modifying the output video size and cropping.

When working with an anamorphic source, selecting anamorphic strict will have your “width” and “height” boxes disabled. The output video will be the maximum size while selecting “loose” allows you to optionally downscale the “width”.

Selecting none allows you to optionally alter both “width” and “height”. The settings used for “width” and “height” should obviously be based on the target device.

Handbrake’s auto crop is not perfect though by default it will try and crop black bars from the video. The crop values could be occasionally but rarely wrong.

Deselecting the Auto-Crop option on the Picture tab should allow you to set your own crop values. The View->Preview menu can be then be used to inspect the changes.

The crop values could be occasionally but rarely wrong. Deselecting the Auto-Crop option on the Picture tab should allow you to set your own crop values. The View->Preview menu can be then be used to inspect the changes.

Handbrake custom crop

Surround Sound

Handbrake can take Dolby Pro Logic, Dolby Digital Surround, Digital Theater Systems(DTS), Digital Theater System Master Audio(DTS-HD), TrueHD and pass them through to your source. By default, audio is downmixed to a format that sounds good on both stereo and multi-channel audio systems.

For a real experience, you can choose the appropriate channel count surround option from the Mixdown dropdown.

Handbrake Mixdown

Passing sound through means the sound is passed bit-for-bit without altering it. The common sounds formats which can be passed through include but is not limited to AC3, MP3, AAC and FLAC.

Handbrake CLI

There is also a command line version of Handbrake which works just like the GUI. The command line version might come in handy when automating task via scripts.

You might want for instance want to download a file and convert it. The file might be huge and the download might take long. In this case, you can write a batch or bash script.

For instance, the following simple bash script should download and convert a file, while you make coffee.

wget -o destinationfile https://pathtofile
handbrake-cli -i destinationfile -o convertedfile

You will also notice that HandbrakeCLI offers a lot more options than can be configured with the GUI version.

Encoding speed

Handbrake can scale to up to 6 CPUs cores meaning the hardware you are encoding on will definitely affect encoding speed.

On new Intel Processors with onboard HD graphics Handbrake supports Intel QuickSync which offers very high-performance encoding at a reasonable quality.

Your source will also definitely affect performance mainly based on the resolution and format.

Squeezing Videos

Squeezing the size of videos is one of Handbrake’s most common use cases.

To reduce disk space or minimize time and bandwidth consumption when uploading a file you might want to reduce its size. This is known as squeezing.

Video formats like AVI are typically known to be lesser compressed than videos encoded using any of the encoders supported by Handbrake. Handbrake supports H.264, H.265, MPEG-4 and MPEG-2 encoders.

Re-encoding an AVI video file with any of Handbrake’s encoders would reduce its size.

H.264 is known to be the format that gives you the highest quality compared to file size.

handbrakevideosqueeze

In other cases, you might also want to further squeeze the size of a video file that is already encoded in Handbrake’s supported codecs.

A few other variables such as pixel dimensions, frame rate, constant or variable bitrate streaming and audio sample rate.

Tweaking these variables is possible with Handbrake but would have some effect on the re-encoded video quality.

Ripping Copyrighted DVDs with Handbrake

Handbrake can rip any DVDs that are not copyrighted while most DVDs are copyrighted. Most people, however, find it okay to rip a DVD to watch a movie on a certain device as long as you’re not starting a bootlegging business.

The process of ripping a copyrighted DVD adds on more step to ripping a non-copyrighted DVD: installing libdvdcss. The process varies from Operating System to the other.

Windows

Download the files from here and copy it into your Handbrake installation folder (Screenshot below shows default path: C:/Program Files/Handbrake)

handbrakelibdvdcss2

Linux

On Linux, mainly Debian and Ubuntu the relevant files can be grabbed here and installed via:

sudo dpkg -i libdvdcss2_version_arch_.deb

After installing liddvdcss2, the copyrighted DVDs can now be loaded and decoded.

Overview of Encoding formats and Video Containers

M4V is a video container format specially developed by Apple for encoding videos, movies, and music videos.

MP4 is a universal video container format used to store video, audio, subtitles, and images.

Given its good compression and compatibility, it allows streaming over the internet and most media players.

MP4 can hold either MPEG-4 or H.264 video codec while M4V container exclusively uses H.264.