Some Handbrake-cli crunching numbers for 53 files

General questions or discussion about HandBrake, Video and/or audio transcoding, trends etc.
Post Reply
chaslinux
Posts: 2
Joined: Wed Nov 14, 2018 7:56 pm

Some Handbrake-cli crunching numbers for 53 files

Post by chaslinux »

I've been playing with handbrake-cli on Xubuntu 18.04 crunching MKV files originally ripped from Blu-ray using MakeMKV. MakeMKV is great for dumping Blu-ray media, but it creates very large files 35GB or more sometimes. In under 8 months I ended up filling our 8TB drive mostly because of the Blu-ray media, so it was time to crunch those files - Handbrake-cli to the rescue.

First I created a shell script hb.sh and added to .bashrc PATH=$PATH:/home/username/scripts (/home/username/scripts is where I put hb.sh) with the very simple code:

#!/bin/bash
HandBrakeCLI -i "$1" -o "${1%.*}-264.mkv" --preset="H.264 MKV 1080p30" -s "1,2,3,4,5,6,7,8"

Run hb.sh with the argument of the video you want to encode:

hb.sh red_lightning_movie.mkv

The resulting file is red_ligtning_movie-264.mkv. We don't have a 4k display so 1080p seemed like a good preset. I tried H.265 initially, but found it took a lot longer to encode, and while the first file I encoded looked great, the second file (a longer file with a lot of black) was noticeably degraded. The -s "1,2,3,4,5,6,7,8" keeps the first 8 subtitles embedded in the video. I used the mkv container since mp4 seemed to only accept one subtitle, and only if you burn it in the movie (which I could be mistaken about - just my research).

After crunching 53 files here are some numbers. The highest compression was a whopping 94%, a file went from 27GB to 1.6GB, The least compressed file was compressed to just over half the size 50.51% from 9.9GB to 4.9GB. The general trend seemed to support these numbers, larger files usually had more compression and smaller files tended to have less compression. Of course all of this depended on the video being compressed.

Five of the files were originally 22GB in size and their respective file sizes were: 3.6GB, 1.7GB, 2.5GB, 2.3GB, and 2.2GB.

For files originally over 30GB the worst compression was a 35GB file that ended up being 7.4GB or 78.86% smaller than the original size.

The average compression over 52 files was 82.46% for an average size of 3.36GB. Here are the actual numbers for the files:

File 1 26.25 2.63 89.98%
File 2 9.9 4.9 50.51%
File 3 21 3.3 84.29%
File 4 6.2 2.4 61.29%
File 5 20 3 85.00%
File 6 16 2.3 85.63%
File 7 16 5 68.75%
File 8 27 1.6 94.07%
File 9 16 2.4 85.00%
File 10 25 4.2 83.20%
File 11 26 4.7 81.92%
File 12 21 2.7 87.14%
File 13 26 7.6 70.77%
File 14 16 3.2 80.00%
File 15 19 5.3 72.11%
File 16 22 3.6 83.64%
File 17 17 3.4 80.00%
File 18 28 4.8 82.86%
File 19 19 2.2 88.42%
File 20 18 5.4 70.00%
File 21 18 5.3 70.56%
File 22 18 3.2 82.22%
File 23 17 4.6 72.94%
File 24 11 1.6 85.45%
File 25 22 1.7 92.27%
File 26 22 2.5 88.64%
File 27 20 4.9 75.50%
File 28 19 3.2 83.16%
File 29 20 2.7 86.50%
File 30 23 3.2 86.09%
File 31 19 2.7 85.79%
File 32 35 7.4 78.86%
File 33 22 2.3 89.55%
File 34 19 4.6 75.79%
File 35 25 2.2 91.20%
File 36 16 4.3 73.13%
File 37 9.8 3.7 62.24%
File 38 25 3.7 85.20%
File 39 21 2.1 90.00%
File 40 29 2.1 92.76%
File 41 18 2.4 86.67%
File 42 26 2.6 90.00%
File 43 28 1.8 93.57%
File 44 14 4 71.43%
File 45 25 1.6 93.60%
File 46 22 2.2 90.00%
File 47 14 2.2 84.29%
File 48 29 2 93.10%
File 49 12 1.4 88.33%
File 50 24 4.6 80.83%
File 51 26 2.7 89.62%
File 52 34 4.4 87.06%
File 53 33 3.5 89.39%
mduell
Veteran User
Posts: 8187
Joined: Sat Apr 21, 2007 8:54 pm

Re: Some Handbrake-cli crunching numbers for 53 files

Post by mduell »

These percentages aren't particularly meaningful given the very different priorities and limitations of the BR author vs you.
Post Reply