With a Plex server, I want my collection of movies backed up digitally so I can watch them when and where I want to. This involves a two-step process. First, I have to rip the video from Blu Ray, which I do using MakeMKV. Since that process is pretty straightforward, I’m not going to cover how to do it here. It’s the second step that is more complicated – compressing the video using HandBrake.
I’ve been using HandBrake for years, but have typically just used the default settings. That’s a terrible idea for a number of reasons, which I’ll detail in this post. But the primary reason why I’m posting is to detail how different settings translate into different file sizes so people have a better sense of what settings to use.
The first thing you need to decide when ripping a video using HandBrake is the resulting file format. I’m using HandBrake 1.3.3 which includes three options: MPEG-4, Matroska, and WebM. Each of these formats has advantages and disadvantages.
MPEG-4 (or mp4/MP4) is the most widespread format and the most compatible with various devices and programs. This is likely going to be the default for most people. However, MPEG-4 has a major limitation – you cannot store multiple subtitles in the video file itself. If you don’t care about subtitles (e.g., you never watch foreign films), that may not matter to you. But it is a problem for those of us who enjoy a good foreign film. (NOTE: The workaround for most people is to save the subtitles as an .srt file in the same folder, assuming your playback device can then load a separate SRT file.)
Matroska (or MKV) is kind of odd. It’s actually not a video codec. It’s an open-standard container. Basically, it’s like a zip file or folder for the actual media. Inside, it can have video files in a lot of different formats, including MPEG-4, but it can also include subtitle tracks and other media. Thus, the major advantage is that you can store more inside a Matroska file than you can in MPEG-4 files. The disadvantage is that not every device or app supports Matroska files natively. However, support for the format has increased quite a bit. Matroska is now my preferred format, mostly because all of the devices I use for playback can play MKV files and I can store subtitles in the same file.
WebM is actually a variant of Matroska but is meant to be a royalty-free alternative to MP4 that is primarily sponsored by Google and supports Google’s VP8 and VP9 codecs. It is licensed under a BSD license. Basically, MP4 is a proprietary codec while WebM is an open-source one. (NOTE: I don’t have any videos stored in WebM format. However, when I create videos to upload to YouTube, I typically rip them into VP9, which is the preferred format for YouTube.)
HandBrake searches for the default audio track from the video you are planning on converting but then does something very odd. By default, it sets whatever audio track that is to be converted to stereo audio (i.e., 2.0 or 2 channels – left and right). You can see that in the screenshot below:
If you have a home theater or good headphones, you’ll want 5.1 surround sound at a minimum. If you have a nicer setup, you’ll want 7.1 surround sound. So, make sure that you delete the default Audio option and instead include a 5.1 surround sound option into your new file. Like this:
(NOTE: I haven’t figured out the best options for 5.1 surround sound. I’m not sure whether AC3 or AC3 passthrough is better. And I’m not sure if Dolby Surround, Dolby ProLogic II, or 5.1 Surround is better. Perhaps someone out there will have insights on this.)
(NOTE: Most modern video players are capable of converting 5.1 surround sound into stereo sound [a.k.a. downsampling]. Not including a 2.0 option is perfectly fine for most people as playback devices will compensate.)
If you haven’t ever used the Tags tab in Handbrake, you really should. By default, the “Title” tag is filled in with whatever information is stored in the video file or DVD you are converting, like this:
However, what you include in the “Title” tag is also what video playback software or devices will think is the name of the video. It is worth taking two minutes to fill in the tags. I typically will change the “Title,” at a minimum, as well as the “Release Date” and “Genre” tags, like this:
Now on to the primary purpose of this post – video quality settings. To determine the ideal balance between quality and file size, I actually converted the same file using different settings. The original file is a rip of the film Amadeus (Director’s Cut) from the Blu-Ray disc that was 28.4 GB in size. The table below illustrates the results of converting the file using different Constant Quality options – all into 1080p video. For each of these conversions, I used identical settings except I changed the Constant Quality option in HandBrake. Each of these used the H.265 (NVenc) encoder with all the other video options on their default settings. Each conversion took about 1 hour (give or take 10 to 15 minutes).
|Setting||Resulting File Size||Compression |
(% of original file)
|CQ 22||14.3 GB||50.35%|
|CQ 24||8.6 GB||30.28%|
|CQ 26||6.5 GB||22.89%|
|CQ 28||4.9 GB||17.23%|
|CQ 30||3.7 GB||13.03%|
|CQ 32||2.9 GB||10.21%|
The big question, of course, is how much degradation there is in quality with the smaller file sizes. To illustrate this, I took a screenshot using VLC from four of the video files: the original, unconverted Blu-Ray rip (28.4 GB file), from the CQ 22 rip, the CQ 28 file, and the CQ 32 file. I uploaded the full resolution files below so you can see and compare the differences.
To help my old eyes see the differences, I zoomed in on just one part of these photos to see if I could tell if there were any meaningful differences:
I thought I might see differences in the quality of the screenshots with the musical score (that’s why I chose this frame). I thought the lines might get blurred or the notes would become fuzzier. But that isn’t actually the case. Most of the space savings actually came from the detail in the brown section of this frame. In the original, if you look closely at the bottom left of the image, you can see lots of “noise.” This is basically film grain. The compression algorithm must look for that kind of noise and then remove it. If you look closely at the CQ 22 frame, there is less film grain. In CQ 28, large swathes of the film grain have been removed. And in CQ 32, all of the film grain has been removed and converted to blocks of single colors. Where there is fine detail in the video or distinct color differences, that has been retained. I should probably try this same exercise with a more modern movie shot digitally and not on film to see how the compression varies. Even so, this is a good illustration of how compression algorithms save space – they look for areas that can be considered generally the same color and drop detail that is deemed unimportant.
TL:DR: My recommendation for file sizes and CQ settings…
Scenario 1: Storage space is genuinely not an issue and you have a very fast internet connection, file server, and home network. You should rip your BluRay disks using MakeMKV and leave them as an MKV file with their full size. That will give you the best resolution with lots of options for future conversion if you want.
Scenario 2: You have a fair amount of storage space, a decent internet connection, a reasonably fast/powerful file server, and a good home network, then I’d suggest a dual approach. If it’s a movie you absolutely love and want the ideal combination of quality while minimizing file size, use a CQ of 22 to 26. That will reduce the quality, but retain much of the detail. If it’s just a movie that you enjoyed and think you might want to watch it again in the future but don’t care so much about the quality, go with a lower quality setting (e.g., CQ of 30 or 32).
Scenario 3: You have very little storage space, your internet connection isn’t great, your file server cannot convert files on the fly, and your home network is meh, then you should probably go for higher levels of compression, like CQ 30 or 32. You’ll still get very good quality videos (compression algorithms are very impressive these days) but in a much smaller sized video. Oh, and you should probably convert your files to MP4.
45,512 total views, 2 views today
10 thoughts on “HandBrake – H.265 NVEnc 1080p Ripping Chart and Guidelines”
Merci beaucoup, c’est parfait. You made a very good job at writing this guide (and your video on Youtube), thanks.
Philippe on Manjaro Linux.
One more thing to notice is that Handbrake defaults to 30fps instead of using source frame rate which will give an uneven playback.So remember to setcit to use source frame rate.
Selecting AC3 over AC3 Passthru should not make much of a difference as your going to be selecting the same audio stream at that point, the other formats though, Dolby Surround and Prologic II are psudo surround formats, they take a 2 channel audio stream and can expand that to 3/4 channels or 5 channels respectively (Dolby Surround had two implementations in the 80s and early 90s, 2 channels for the front and 1 channel for the rear split across two speakers, and in the 90s they added a center channel for the front) 5.1 surround just does what it says on the tin. though you have options for codec to use, AAC, MP3, FLAC… your choice but be careful on the bitrates, the lower it is the worse it sounds.
As for encoding quality, you can try it yourself, use the same QC options but select software encoding (x256) not NVenc, as NVenc is crap for video quality… and uses up quite a bit more space too. But yes it takes longer using software, you do get a better output. Also as another poster said, for frame rate select Same as Source and hit the checkbox for constant frame rate, no need to try and make things weird with a variable frame rate.
Thank you for a great tutorial/recommendation. One question, the Genre, is it possible to add more tags to it? How then, comma seperated or just space?
I just tested this. Commas worked, though all the tags I put in were simply written into the single genre tag. I’m not sure if those tags would be recognized individually by software that examines the tags. They may be combined. So, something like “Action, Adventure” may not be classified by software as “Action” and separately as “Adventure” but rather as a new category “Action, Adventure.”
What software are you using to organize by genres? I could try it out to see how it is classified.
I totally disagree about the nvenc nvidia encoding being bad, I’ve played the original blu ray files right next to the same files encoded with h265 nvenc nvidia cq 20 1080p mkv and can not tell much of a difference at all. It also cuts the processing time in half, going from a full hour for 1 hr of video down to 30 mins. The file sizes between h264/cpu vs h265/gpu are either the same or only marginally larger as well. From what I see there is only one pass with the nvidia nvenc so that may be the difference in time, not sure. Now my comparison was not on a 50″ 4k tv it was on a 15.6″ 120hz 1080 laptop screen so the differences would be more apparent there no doubt, BUT I’m never going to have those side by side on a 4k tv that I don’t even have. Both original and ripped are only at 1080p as well so I’d have bigger issues just from the original bluray makemkv file on a 4k tv anyways. An hour of video rips to about 4-5gb average for an input file of about 16-17gb, 44gb bluray down to 11gb. I’m using an i5-10300h, RTX 2060 mobile so going the gpu route makes a lot more sense for me.
I’ve been reading so much on Handbrake and conversions that I get conflicting opinions. Some claim Constant Quality over Bit Rate… so which is going to be best for quality and file size?
Also think another issue I have is my laptop is archaic, was purchased in 2011-2012, so my conversions take what seem to be absolutely forever for one file… unless I’m doing something very wrong in the Handbrake settings.
Good question. I don’t know the answer to that one.
It’s become apparent that I need to do some additional testing for optimal settings on HandBrake.
I’ll add this to my future tutorials that I need to work on.
First and foremost, thanks Ryan for an awesome write up! Much love to anyone who shares their experiences to lend a helping hand.
Like most, I’m looking for that sweet spot which suits my needs. I use plex as well to stream all my media on a 6 year old custom rig (i7 4790k & nvidia gtx 970). Since my processor is old, I like to take advantage of NVenc since, as others have mentioned, cuts the encode time in half (mostly).
My goal is to take my entire library and convert each to mp4 1080p h265 using NVenc. My goal is to compress each movie down as much as possible while still maintaining the original quality. This is, in my opinion, everyones goal generally speaking (if not, thats fine, which is why it’s my opinion :)) . As one would maintain the same quality while saving on space. If the quality remains the same and the resulting file size is much smaller, why wouldnt you go that route? Maybe I’m missing something…
In my experience using handbrake, I find that if I match the bitrate from the source (right click, properties, details tab, value under data rate within the video section) and input that bitrate into the avg bitrate option under the quality section of the video tab, this is achieved. However, the bitrate for the source file is different, thus making it a manual process with each encode. The resulting file size is also different as each source is as well. Although on average, a 7 to 10GB file drops to 1 to 3GBs. To save a little time, I save a present with most of these settings set, then adjust bitrate and audio accordingly. If I use the CQ setting of 20 (which I see most recommend for 1080p) instead of matching the bitrate using the avg bitrate option, the output file size remains the same, or larger.
Maybe I don’t fully understand the differences between the 2 options, butI think the results speak for themselves. I would love to see what you (and others) find during your testing, and if you have any further recommendations that could save time, and space while maintaining the original quality.
Just a quick note. Given you’re description of how you’re applying h265, you are losing some of the original quality. It’s possible to use h265 so no information is lost (i.e., lossless), but, for most of us, we are losing quality in compressing the files as much as we do. See here: https://en.wikipedia.org/wiki/Comparison_of_video_codecs
The real question is whether the “loss” in information is noticeable. If there was an easier way to use Netflix’s VMAF metric to test video quality, I would put together a new post testing a bunch of options in Handbrake. For now, VMAF is still too challenging for me to set up.