HandBrake is a free, open source, and multi-platform video transcoder tool that can be used to convert videos of any format to modern, and widely supported codecs. It supports popular operating systems, including GNU/Linux, Mac OS X, and Microsoft Windows. Believe me or not, Handbrake helped me to encode a video of size 1.7 GB shot from a Canon Camera (.mov file) to just 50 MB (.mp4 format). It is a quite powerful transcoder. In this tutorial, we will learn how to encode high quality movies and videos using Handbrake application on Linux.
Table of Contents
Install HandBrake in Linux
The officially recommended way to install HandBrake is by using flatpak from Flathub. Make sure you have installed flatpak and enabled the Flathub repository. If not, refer to the following link to know how to do it.
Next, run the following command to install HandBrake:
Install HandBrake using Ubuntu PPA
The another way to install HandBrake is using its official PPA.
If you're on Ubuntu and its derivatives like Linux Mint, Elementary OS, and Pop!_OS, run the following commands:
sudo add-apt-repository ppa:stebbins/handbrake-releases
sudo apt-get update
sudo apt-get install handbrake-gtk
If you want command line version, run:
sudo apt-get install handbrake-cli
On Arch Linus based Systems:
On Arch Linux and derivatives, you can install using command:
sudo pacman -S handbrake
To install CLI version, run:
sudo pacman -S handbrake-cli
For other distributions, get the latest version of Handbrake from here, and compile and manually install it yourself.
Launch Handbrake
After installing Handbrake, launch it either from the Application Menu or Dash.
The default interface of HandBrake GUI should look like below.
Encode High Quality Movies and Videos Using Handbrake
Encoding videos with HandBrake is easy!
To encode a video, simply following the steps below:
1. Click “Source” button in the top left corner and select the videos that you want to encode.
2. Select the destination where you'd like to save the encoded video and choose the output format of your choice such as .mp4 or .mkv.
In the “Summary” section you will see the video details like video dimensions, frame rate, Aspect ratio and codecs.
3. Now choose the preferred “presets” in the right corner. If you are a beginner and don't know to select which preset, just select “Normal” preset. This is the handbrake default preset. Every settings will be changed automatically depending upon the selected preset. I strongly suggest you do not change any settings if you're familiar with Handbrake presets.
4. If you want to play videos in any ordinary mobile phones, check the supported video dimensions, video and audio bit rate, Frame rate etc., from manufacturers' site.
5. Click the “Video” tab, select the video encoder. To play the videos in your mobile or ipad, you may need to choose “mpeg-4” in the “video encode” dropdown box. Select the frame rate and bit rate or leave the defaults.
6. Click the “Audio” tab and select the encoder, bit rate etc.
7. Go to “Subtitles” tab and select the subtitle for your videos if you have one. Select whether the subtitle should be hardcoded or softcoded.
8. Click “Advanced” tab, change the values as per you need or just leave them as it is. Here, I have given some advanced string settings from the Handbrake website. Just copy and paste them in the “Current x264 Advanced Option String” column box.
Ultrafast:
ref=1:bframes=0:cabac=0:8x8dct=0:weightp=0:me=dia:subq=0:rc-lookahead=0:mbtree=0:analyse=none:trellis=0:aq-mode=0:scenecut=0:no-deblock=1
Superfast:
ref=1:weightp=1:me=dia:subq=1:rc-lookahead=0:mbtree=0:analyse=i4x4,i8x8:trellis=0
Veryfast:
ref=1:weightp=1:subq=2:rc-lookahead=10:trellis=0
Faster:
ref=2:mixed-refs=0:weightp=1:subq=4:rc-lookahead=20
Slow:
ref=5:b-adapt=2:direct=auto:me=umh:subq=8:rc-lookahead=50
Slower:
ref=8:b-adapt=2:direct=auto:me=umh:subq=9:rc-lookahead=60:analyse=all:trellis=2
Very Slow:
ref=16:bframes=8:b-adapt=2:direct=auto:me=umh:merange=24:subq=10:rc-lookahead=60:analyse=all:trellis=2
9. Click the “Picture Settings" tab and set dimensions that supports your device.
10. Now click "Start" button to start converting video. If you have many videos to convert, simply click "Add to Queue" button to queue these and start task from the "Encode Queue" dialog.
HandBrake will start encoding the video file. It will take a while depends on the size of the file. Sit back and relax!
The encoded videos will saved in the destination that you choose in the earlier step.
For more detailed usage, I recommend you to look at the HandBrake documentation.
Resource: