The Robservatory

Robservations on everything…

 

A deep dive into HandBrake and Video Transcoding

An obvious interest area of mine is in ripping (and watching) movies using my Mac. I’ve talked about everything from installing the tools I use to how I rip to how to make sure I update the ripping tools. And though I’ve included some comparison pictures in the how-I-rip article, I’ve never done a deep dive into the various ripping options and how they compare on three key fronts:

  • Speed: Faster is better; measured in minutes required to rip.
  • Size: Smaller is better; measured in MB of drive space used.
  • Quality: Higher is better; the closer the image quality is to the original, the better.

An ideal rip would be one that happens in seconds, saves into a 10KB file, and has quality matching the original. The reality, though, is far from the ideal. Ripping a movie involves making trade-offs between those three competing measures: Maximizing any one measure requires some sort of tradeoff with one or both of the other measures.

After ripping so many DVDs and Blu-rays over the years, I was curious about how HandBrake and Don Melton’s Video Transcoding tools handle those tradeoffs, so I decided to do some testing.

If you’d like to see what I discovered about ripping time, file sizes, and—with lots and lots of frame grabs—image quality, keep reading…

For my tests, I used Florence and the Machine’s music video for Miss Peregrine’s Home for Peculiar Children, a very entertaining Tim Burton film. The music video is included on the Blu-ray, and has a nice mix of scenery, action, and actors from which to choose test footage.

Using the music video, I performed six separate tasks:

  1. Ripped the music video using all of each tool’s available pre-set options—but only those that rip at 1920×1080. For HandBrake, this meant 15 presets to test, and 11 more for transcode-video, for a total of 26 different rips. I recorded the time required to convert the music video, as well as the file size, and the bit rate of the converted video.
  2. Exported a still—with faces, detailed objects, and sky—from all 26 conversions. I did not create a zoomed-in version of this shot.
  3. Exported a still showing some facial features from all 26 conversions. Create zoomed-in views of that frame.
  4. Exported a still showing some detailed object from all 26 conversions. Create zoomed-in views of that frame.
  5. Compared the image quality of the two zoomed-in images using similar settings (file size, bit rate, etc.) in HandBrake and transcode-video.
  6. Ripped the entire movie using a comparable setting in each app. For HandBrake, I used “HQ 1080p30 Surround.” For transcode-video, I used --target big, which increases the allowed bit rate.

Needless to say, this took quite a bit of time, but I think the results will help you understand the tradeoffs between speed, file size, and quality in ripping with both tools.

Note that this analysis is focused solely on the presets in each tool: Both offer the ability to customize your settings, but there’s simply not enough time available to consider the permutations these customizations allow. So I focused on what you get using “out of the box” settings…and there are still 26 of those, so that was plenty!

Also of note, these results are particular to my Mac (a late 2014 5K Retina iMac with a Core i7), and to the video I used for testing. I didn’t rip over night, instead ripping while doing other things, which is how I usually do it. So yea, your mileage may vary with your own results.

Test 1: Rip the music video

On the Blu-ray, the music video is 2:18 long. When I ripped it to the hard drive using MakeMKV, the final file size was 279MB. I then fed this .mkv file to both HandBrake and transcode-video, running it through all 26 different conversion options.

This table shows the results, sorted by ripping app first, then by file size (smallest to largest) for each app. I didn’t intermingle them because it’s much easier to see how a given setting within each app will affect the final output. Those who keep scrollbars hidden, please note the following section does scroll—scroll down to see all of the results.

HandBrake File Size,(MB) Rip Time (min:sec) Rip Speed (fps) Data Rate (Mbit/sec)
very fast 1080p30 60.2 1:00 55.2 3.48
android 1080p30 90.6 2:08 25.88 5.24
win10 mobile 1080p30 90.6 2:10 25.48 5.24
firetv 1080p30 surr 94.4 2:07 26.08 5.46
xbox legacy 1080p30 surr 94.5 2:05 26.5 5.46
fast 1080p30 95.2 2:14 24.72 5.5
apple 1080p60 surr 100.4 2:15 24.53 5.81
apple 1080p30 surr 100.4 2:17 24.18 5.81
chromecast 1080p30 surr 100.4 2:22 23.32 5.81
playstation 1080p30 surr 100.4 2:17 24.18 5.81
roku 1080p30 surr 100.4 2:13 24.9 5.81
xbox 1080p30 surr 100.4 2:17 24.18 5.81
hq 1080p30 surr 138.9 5:49 9.49 8.04
superhq 1080p30 surr 176.4 7:22 7.49 10.21
transcode-video File Size,(MB) Rip Time (min:sec) Rip Speed (fps) Data Rate (Mbit/sec)
target small 76.3 1:50 30.25 4.41
preset veryslow 105.9 6:12 8.9 6.12
preset slow 106.2 3:12 17.22 6.14
preset slower 106.3 4:33 12.14 6.15
no options (default) 106.7 2:10 25.48 6.17
preset faster 106.7 1:09 47.95 6.17
quick 106.8 1:07 49.54 6.18
preset fast 106.8 1:43 32.18 6.18
veryquick 106.9 1:01 54.70 6.18
preset veryfast 106.9 0:47 70.53 6.19
target big 141.5 2:24 23.08 8.19

That’s a lot of data, but here are some general observations:

  • The transcode-video tools target 6Mbits as the data rate for Blu-rays, and every option (save small and large, which aren’t subject to that constraint) comes very close to that number.
  • HandBrake’s data rates are more variable, ranging from 3.8 to 10.2, with most falling in the five Mbit range.
  • The transcode-video tool is much faster than HandBrake is when using any of its predefined ripping formats. You can change HandBrake’s settings for better speed using this slider in its settings:

    I did not run tests with the slider at different points; I wanted to see how each performed “out of the box.”

  • The two highest-quality settings in HandBrake are both notably slower than the high quality option in transcode-video—they actually approach the speed of the “very slow” option in transcode-video.

But enough about the speed and file sizes; let’s talk about image quality…

Aside: Image quality testing methodology

For each of the image quality tests, I started with the original MKV file, playing back in the MacGo Blu-ray Player. I copied a frame as my starting point, and pasted it into Acorn.

I then copied that same frame from all 26 of the ripped versions of the music video, adding and aligning each as a new layer in Acorn. Once all that was done (three times over), I dumped all the images into separate PNG files, and then used sips to convert the PNGs to somewhat-more-reasonably sized JPGs.

Finally, those JPGs were uploaded into a slideshow tool, to allow easy flipping between all the captures. There are potentially some errors introduced when I converted to JPGs, but it’s the only way to get semi-reasonable file sizes for image browsing. However, I’ve also linked to the original PNGs as downloadable bundles, in case you want to look at the full-quality versions.

Test 2: Full frame size non-zoomed image

For this test, I chose an outdoor scene with a patch of blue sky, a complicated leafy vine, and two visible faces. You can flip through the full deck below; the slides aren’t in any particular order, other than they’re grouped by which encoder was used.

Original Blu-ray
HandBrake: Very Fast 1080p30
HandBrake: Fast 1080p30
HandBrake: HQ 1080p30
HandBrake: Super HQ 1080p30
HandBrake: Android 1080p30
HandBrake: Apple 1080p60
HandBrake: Apple 1080p30
HandBrake: Chromecast 1080p30
HandBrake: FireTV 1080p30
HandBrake: Playstation 1080p30
HandBrake: Roku 1080p30
HandBrake: Windows 10 Mobile 1080p30
HandBrake: Xbox 1080p30
HandBrake: Xbox Legacy 1080p30
transcode-video: target big
transcode-video: target small
transcode-video: quick
transcode-video: very quick
transcode-video: preset very fast
transcode-video: preset faster
transcode-video: preset fast
transcode-video: preset slow
transcode-video: preset slower
transcode-video: preset very slow
transcode-video: defaults

Download the full-size PNGs [87MB] [This is a Dropbox link; please let me know if it breaks.]

At this scale, especially shrunk down to fit on the blog’s page width, you really can’t see the minute changes that occur in each image. You can notice large-scale changes, like brightness or fuzziness. But to really see what the encoders do to images, you have to zoom in. So that’s what I did next…

Test 3: Zoomed-in facial features

Using a slightly different shot from the same moment in the music video, I started with the actor’s face isolated:

I exported these crops at their original size as full-quality PNGs. I then used sips to convert to JPG and scale up by 800%. I opened all of these in Acorn, aligned and exported again as PNGs, then used sips to convert back to JPGs to assemble into this flippable album.

Original Blu-ray
HandBrake: Very Fast 1080p30
HandBrake: Fast 1080p30
HandBrake: HQ 1080p30
HandBrake: Super HQ 1080p30
HandBrake: Android 1080p30
HandBrake: Apple 1080p60
HandBrake: Apple 1080p30
HandBrake: Chromecast 1080p30
HandBrake: FireTV 1080p30
HandBrake: Playstation 1080p30
HandBrake: Roku 1080p30
HandBrake: Windows 10 Mobile 1080p30
HandBrake: Xbox 1080p30
HandBrake: Xbox Legacy 1080p30
transcode-video: target big
transcode-video: target small
transcode-video: quick
transcode-video: very quick
transcode-video: preset very fast
transcode-video: preset faster
transcode-video: preset fast
transcode-video: preset slow
transcode-video: preset slower
transcode-video: defaults
transcode-video: preset very slow

Download the full-size PNGs [40MB] [This is a Dropbox link; please let me know if it breaks.]

In zoomed-in mode, you can see the differences in the encoders. Facial features get smoothed out of existence; the sweater’s pattern becomes less clear, and there are even some visible errors—in some of the images, there’s a straight black line running down from the ear near the end of the jaw line.

Test 4: Zoomed-in leaf details

This test proceeded like the prior test, starting with a full-frame grab, cropping out a section, zooming 8x, then re-exporting and converting to JPG. Again, in the zooms, you can really see the differences in the encodings, with some doing a very good job on the leaf detail, and some doing, well, not so good of a job.

Original Blu-ray
HandBrake: Very Fast 1080p30
HandBrake: Fast 1080p30
HandBrake: HQ 1080p30
HandBrake: Super HQ 1080p30
HandBrake: Android 1080p30
HandBrake: Apple 1080p60
HandBrake: Apple 1080p30
HandBrake: Chromecast 1080p30
HandBrake: FireTV 1080p30
HandBrake: Playstation 1080p30
HandBrake: Roku 1080p30
HandBrake: Windows 10 Mobile 1080p30
HandBrake: Xbox 1080p30
HandBrake: Xbox Legacy 1080p30
transcode-video: target big
transcode-video: target small
transcode-video: quick
transcode-video: very quick
transcode-video: preset very fast
transcode-video: preset faster
transcode-video: preset fast
transcode-video: preset slow
transcode-video: preset slower
transcode-video: preset very slow
transcode-video: defaults

The edges of the leaves are particular trouble spots; notice how poorly they’re handled by some of the presets. The actress’ hair is in the background, and in some of the encodings, it’s not really hair but a lightish-colored blob.

Download the full-size PNGs [42MB] [This is a Dropbox link; please let me know if it breaks.]

Test 5: Comparison of HandBrake and transcode-video

In this test, I looked at the two zoomed-in images, using a set of similar settings/results from each app. This let me directly compare the two programs’ encodings for different criteria. I thought it might be interesting to compare each programs’ performance in five areas: smallest and largest file size (also a measure of quality), slowest and fastest encode speed, and finally, closest data rate match.

For each comparison area, you can drag a slider across the two zoomed-in images from Handbrake and transcode-video to directly compare the results of the two programs’ encodings.

Largest file size

TV: target big
Rip Time: 2:24 min:sec
File Size: 141.5MB
Bit Rate: 8.19Mbit
HB: SuperHQ 1080p30
Rip Time: 7:22 min:sec
File Size: 176.4MB
Bit Rate: 10.21Mbit

Even when zoomed in, the stills are nearly indistinguishable. But the transcode-video rip is over three times as fast as the HandBrake rip, and the final file size is 35MB smaller. Impressive.

Smallest file size

TV: target small
Rip Time: 1:50 min:sec
File Size: 76.3MB
Bit Rate: 4.41Mbit
HB: Very Fast 1080p30
Rip Time: 1:00 min:sec
File Size: 60.2MB
Bit Rate: 3.48Mbit

HandBrake did a good job here with both speed and file size. With the lower bit rate, some image degradation is visible, but if you’re shooting for small file sizes, you’re probably willing to make that tradeoff.

Fastest encode

TV: preset veryfast
Rip Time: 0:47 min:sec
File Size: 106.9
Bit Rate: 6.19Mbit
HB: Very Fast 1080p30
Rip Time: 1:00 min:sec
File Size: 60.2MB
Bit Rate: 3.48Mbit

In this comparison, transcode-video uses a much higher target bit rate, leading to a larger file size (but also faster performance). Quality wise, the higher bit rate pays off, as the transcode-video image is better—the actor’s skin loses a lot of its detail in the HandBrake version.

Slowest encode

TV: preset veryslow
Rip Time: 6:12 min:sec
File Size: 105.9
Bit Rate: 6.12Mbit
HB: SuperHQ 1080p30
Rip Time: 7:22 min:sec
File Size: 176.4MB
Bit Rate: 10.21Mbit

Honestly, I have no idea why you’d want to pick the slowest encode option, given that faster options give near-identical results in much less time. But, if you do, it appears that it’d be best to use transcode-video. The rip time is faster, the final file size is much smaller, and there are only the tiniest of differences in the visual quality.

Closest data rate match

In looking at all 26 encodes, the two closest matches are for transcode-video‘s “–target big” (8.19Mbit) and HandBrake’s HQ 1080p30 (8.04Mbit). Here’s how those two compare.

TV: target big
Rip Time: 2:24 min:sec
File Size: 141.5MB
Bit Rate: 8.19Mbit
HB: HQ 1080p30
Rip Time: 5:49 min:sec
File Size: 138.9MB
Bit Rate: 8.04Mbit

The zoomed-in images reveal almost no differences, which gives the edge to transcode-video, as it’s rip time is under half that of HandBrake while creating a file that’s nearly identical in size. Given there’s no drop-off in quality, take the time savings!

Test 6: Ripping an entire movie

For the final test, I converted the entire Miss Peregrine’s movie, using the most-comparable bit rate settings from above: “–target big” in transcode-video, and HQ 1080p30 in HandBrake.

The full movie runs 2:06:56, comprises 182,594 frames, and took up 29.1GB of drive space after extracting it using MakeMKV.

Using transcode-video, it took just over two hours (2:09) to rip the movie. The final file size is 8.37GB, and the data rate is 8.78Mbit. The rip speed, in frames per second, was 23.57.

Using HandBrake, it took 2:46 to rip the movie, but the final file size is only 4.66GB. Why smaller? Because the final data rate is 4.88Mbit. The rip speed, in frames per second, was 18.33.

Honestly, I don’t know what happened with the HandBrake full movie rip. Using HQ 1080p30 mode on the music video resulted in a data rate of 8.04MBit…yet the full movie came out under 5MBit. That seems odd, but I don’t have the time required to rip it yet again.

Wrapping it all up

Both HandBrake and transcode-video do a great job of ripping Blu-ray discs. This shouldn’t be surprising, as transcode-video uses HandBrake. In theory, you could get the same results it gets by modifying the settings in HandBrake. In theory.

In reality, this is why I prefer transcode-video: Yes, I have to type a few words into Terminal to get it started, but it’s doing all the hard set-up work for me. Its output is uniformly excellent, and rips are generally much faster than using any of the available HandBrake presets.

If you use HandBrake, it’s probably worth some time experimenting with the settings—especially the referenced encoder speed setting—to find a balance that works for you.

[I learned a lot about video ripping during this process, mostly thanks to Don Melton’s patience in explaining various things to me—so thanks, Don, not only for transcode-video, but for helping me through this project!]

15 Comments

Add a Comment
  1. Thanks for the excellent work & post Rob! I long ago moved to Don’s transcode-video scripts but never took the time to compare in the kind of detail you have. Great work.

  2. Good work. But I feel like this info should be fed back to Handbrake itself so that they can improve their preset’s.

    1. I can only assume they have their reasons for setting their presets as they do—they know this stuff much better than do I. I’ve already got too much to do, so I really don’t need to tackle another project ;).

      -rob.

  3. Wow, this is pretty thorough. I used to rip movies but there’s so much stuff to watch I rarely watch anything twice, so I stopped.

    1. Honestly, I have no idea—you could ask Don via the contact link on his page. I’m just a user of his tools :).

      -rob.

  4. Awesome and thorough piece – good work!

    Just one thought however; the comparisons are directly between image quality – I haven’t ripped that many DVDs and/or Blu-Rays myself, but shouldn’t the audi quality and bitrate factor in when it comes to file size and rip speed? Also, how does the presets compare when it comes to multiple audio tracks and such?

    1. There are a couple of things at work here…

      1) I’ve never had any audio issues with any rips, so it’s not really a focus area.
      2) The small clip I used to do all the test rips is a stereo-only music video, so nothing to really test on encode.

      The full movie tests both create two tracks: A stereo mix on track one, and the surround mix on track two, which is used by the Apple TV. If you need surround but not via Apple TV, then (as I understand it) you can’t rip to mp4, but only mkv.

      -rob.

  5. Before reading all the way through your article – and getting to the side-by-side compares – I had downloaded your .zip file and was comparing them sequentially at 200% zoom in Preview.pp. I had focussed on the smooth gradations and edges in the lightly-shadowed girl’s face, and found more differences there than I subsequently noticed after scrolling down and discovering you’d done an interactive comparison on a different area.

    In my less rigorous comparison I found that Handbrake’s “Apple1080p60” rendering seemed to have the smoothest tonal transitions but only slightly less edge detail than TV’s noisier “PresetFaster”, which seemed the best rendering of this area of all the TV presets. Note that at 100MB, the file sizes are comparable between these two methods, so the price being paid for the very slightly increased quality of Handbrake’s conversion is a factor of x2 in CPU time.

    At 1:1, these differences in smoothness and sharpness were invisible, and the obvious difference became the different tonal curve or gamma applied by these converters. Handbrake’s conversion seems warmer, slightly flatter and more “cine-like” while TV seemed to produce a more contrasty and cooler rendition. If you like Handbrake’s tone but prioritize TV’s faster conversion time you could probably make up for these tonal differences with small tweaks to your monitor’s color settings.

  6. Sand Still Pictures give you rough 50% info how good compression you have done. You are not compressing standing pictures. You are using algorithms that look several frames back and several forward. In bad compression you will see for example a person showing three fingers for example and you see after a compression only two, maybe no fingers at all. But if are comparing frames only, then you might miss this if you don’t look at the right place.
    https://en.wikipedia.org/wiki/Video_compression_picture_types

  7. Thanks for this info. I’ve done some testing with tools that will convert container formats, instead of transcoding the video into a new format. If your source video is in H.264 then you may be able to very quickly put it in a new container (and maybe, depending on the output you are targeting, transcode the sound from AAC to AC3). I haven’t tried this method with a raw bluray rip though, so I don’t know if it would work.
    It is considerably quicker however than transcoding – if your source and destination are on different drives (or both on fast flash storage) you’ll get amazing throughput.

  8. Thanks for all of these details. I’ll be interested to know whether you’ve done any comparisons with ffmpeg. I routinely transcode 1080i captures, and although I’ve tried Don Melton’s tools, I still have to say I get slightly better results with detelecine using ffmpeg.

    1. Don’s tools also use ffmpeg, so any differences must be due to different settings—I use his tools mainly because of the ease of getting good quality rips with no work on my part :).

      -rob.

  9. Thanks for the knowledge share. Super helpful! Quick question: I’m trying to resize a 4k rip down to 1920 width while maintaining whatever the aspect ratio of the source file is. I execute with these arguments, but the resulting file is not constrained to 1920px wide: transcode-video sample.mkv –quick –copy-audio all —-max-width 1920 —-target big

    1. Unfortunately, I haven’t done any scaling with transcode-video, though I’m guessing you might have to use the crop preview feature to add a height command as well. I’d suggest posting to the issue page on Don’s github project; he’s quite good about replying to users’ posts.

      -rob.

Leave a Reply

The Robservatory © 2017 Built from the Frontier theme