With upcoming changes to data protection and privacy laws in Europe coming into effect soon, we thought this would be a good time to remind everyone that we do have a privacy policy.
This applies to all users and visitors world-wide.

We have made a few changes to the language to make it clearer in relation to this new regulation but fundamentally, the terms and your rights are unchanged.

If you have any questions about this, please feel free to ask in the General Forum

Best Quality, Small Size And And A Fast Rip

Discuss encoding for devices and presets.
Forum rules
An Activity Log is required for support requests. Please read How-to get an activity log? for details on how and why this should be provided.
Post Reply
drumkey87
Posts: 2
Joined: Wed Dec 02, 2009 3:31 am

Best Quality, Small Size And And A Fast Rip

Post by drumkey87 » Wed Dec 02, 2009 3:35 am

Can anyone give me some settings for a Good quality and fast rip at a small size?

TedJ
Veteran User
Posts: 5388
Joined: Wed Feb 20, 2008 11:25 pm

Re: Best Quality, Small Size And And A Fast Rip

Post by TedJ » Wed Dec 02, 2009 8:41 am

Can't be done.

There's an old maxim: Speed, size, quality... pick two.

kvaruni
Posts: 56
Joined: Tue Mar 24, 2009 1:12 pm

Re: Best Quality, Small Size And And A Fast Rip

Post by kvaruni » Wed Dec 02, 2009 11:31 am

The title says Best quality, but the topci says good Quality, indicating that he may be willing to let this one slip a bit. Nevertheless, quality is often superb when using H.264, so this should not be a big deal for almost all applications.

Give my settings a spin. These are optimised to be used on iPod touches, Apple TV and for streaming across my wireless network and I use the same settings for almost everything, being it old TV series, DVD rips or Blu-Ray movies. In general, it requires roughly 100Mb/10 minutes of high quality DVD source and around 200Mb/10 minutes Blu-Ray in 720p. Encode speeds on my 2.4Ghz Core 2 Duo are roughly 45fps for DVD input and roughly 25fps for Blu-Ray converts.

So, encode with an RF=20 and use x264 as your encoded format. Does not matter really what you pick as container (MP4, MKV) or what you do with your available audio tracks. The settings are then (just paste them at the bottom of the advanced tab page):
ref=3:mixed-refs=1:bframes=0:b-adapt=0:direct=none:weightb=0:me=dia:subq=6:analyse=none:cabac=0:psy-rd=1.0,0.0:no-fast-pskip=1:no-dct-decimate=1:deblock=0,0:mbtree=1:8x8dct=0:vbv-maxrate=12000:vbv-bufsize=2500:weightp=0

Basically, it turns off b-frames and all advanced features, retains psycho-visual to get better encodes and increases size of the file a bit to improve quality. It also forces mbtree for considerably smaller file sizes (thus compensating for the bigger files I just talked about) and forces vbv settings to ensure that even Blu-Ray plays nicely on the AppleTV (Yes, even Planet Earth, Yippie!).

These are certainly not the best settings to be found, but they play on nearly every device you might possibly lay your hands on (given that you respect the [screen] size of your device) and they get your movie encoded at a very nice speed with more than decent quality.

jbrjake
Veteran User
Posts: 4805
Joined: Wed Dec 13, 2006 1:38 am

Re: Best Quality, Small Size And And A Fast Rip

Post by jbrjake » Wed Dec 02, 2009 2:12 pm

Disabling B-frames is entirely counter-productive for the original poster's goals.

kvaruni
Posts: 56
Joined: Tue Mar 24, 2009 1:12 pm

Re: Best Quality, Small Size And And A Fast Rip

Post by kvaruni » Wed Dec 02, 2009 4:58 pm

Yeah, like this would be the first person encoding for an iPod or some other baseline device... B-frames will clearly offer smaller sizes and faster encodes, but without any additional information I'm assuming a baseline device. Next time, pick on the fact that CABAC is off :| .

User avatar
Rodeo
HandBrake Team
Posts: 11849
Joined: Tue Mar 03, 2009 8:55 pm

Re: Best Quality, Small Size And And A Fast Rip

Post by Rodeo » Thu Dec 03, 2009 9:21 pm

Setting partitions to none isn't a very good idea. Also, hex is barely slower than dia and gives better results.

I took your options, encoded one of my test clips with it, and then tested a few modifications. Note that I'm using SSIM as a quality metric, which can be considered good enough since the subme and psy-rd values are the same across all settings I tested. I've also compared the first and last tests visually and the last settings definitely look better than the first to me (granted, I was not blind testing, but still).

First, your settings (some options got trimmed by the advanced settings panel, but they won't affect output):

Code: Select all

[21:12:58]    + encoder: x264
[21:12:58]      + options: ref=3:mixed-refs=1:bframes=0:weightb=0:me=dia:subq=6:analyse=none:cabac=0:psy-rd=1.0,0.0:no-fast-pskip=1:no-dct-decimate=1:deblock=0,0:mbtree=1:8x8dct=0:vbv-maxrate=12000:vbv-bufsize=2500:weightp=0
[21:12:58]      + quality: 20.00 (RF)

[21:14:52] work: average encoding speed for job is 52.496204 fps

x264 [info]: SSIM Mean Y:0.9781506
x264 [info]: PSNR Mean Y:42.764 U:48.669 V:48.396 Avg:43.967 Global:43.595 kb/s:2380.92
Then, turning off no-fast-pskip:

Code: Select all

[21:35:25]    + encoder: x264
[21:35:25]      + options: ref=3:mixed-refs=1:bframes=0:weightb=0:me=dia:subq=6:analyse=none:cabac=0:psy-rd=1.0,0.0:no-dct-decimate=1:deblock=0,0:mbtree=1:8x8dct=0:vbv-maxrate=12000:vbv-bufsize=2500:weightp=0
[21:35:25]      + quality: 20.00 (RF)

[21:37:16] work: average encoding speed for job is 54.135971 fps

x264 [info]: SSIM Mean Y:0.9779601
x264 [info]: PSNR Mean Y:42.723 U:48.659 V:48.379 Avg:43.930 Global:43.566 kb/s:2347.92
Small speed bump, slight quality and bitrate drops.

Setting the number of ref frames to 1 (effectively dropping mixed-refs):

Code: Select all

[21:21:55]    + encoder: x264
[21:21:55]      + options: ref=1:mixed-refs=0:bframes=0:weightb=0:me=dia:subq=6:analyse=none:cabac=0:psy-rd=1.0,0.0:no-dct-decimate=1:deblock=0,0:mbtree=1:8x8dct=0:vbv-maxrate=12000:vbv-bufsize=2500:weightp=0
[21:21:55]      + quality: 20.00 (RF)

[21:23:23] work: average encoding speed for job is 67.971024 fps

x264 [info]: SSIM Mean Y:0.9777506
x264 [info]: PSNR Mean Y:42.677 U:48.586 V:48.310 Avg:43.881 Global:43.522 kb/s:2364.60
Significant speed bump, slight increase in bitrate (lower refs, less compression). Small quality drop too.

Setting partitions to the default x264 value (p8x8,b8x8,i8x8,i4x4):

Code: Select all

[21:14:54]    + encoder: x264
[21:14:54]      + options: ref=1:mixed-refs=0:bframes=0:weightb=0:me=dia:subq=6:cabac=0:psy-rd=1.0,0.0:no-dct-decimate=1:deblock=0,0:mbtree=1:8x8dct=0:vbv-maxrate=12000:vbv-bufsize=2500:weightp=0
[21:14:54]      + quality: 20.00 (RF)

[21:17:32] work: average encoding speed for job is 37.902779 fps

x264 [info]: SSIM Mean Y:0.9787365
x264 [info]: PSNR Mean Y:42.900 U:48.706 V:48.423 Avg:44.092 Global:43.745 kb/s:2265.71
Setting partitions to default from none compensates for both the drop in quality and increase in bitrate, delivering better quality than your settings, at a bitrate over 100 kb/s lower. Of course, despite dropping no-fast-pskip and lowering the refs, there's still a significant speed cost.

Now, setting partitions to something between the default and none (i8x8, i4x4):

Code: Select all

[21:17:35]    + encoder: x264
[21:17:35]      + options: ref=1:mixed-refs=0:bframes=0:weightb=0:me=dia:subq=6:analyse=i8x8,i4x4:cabac=0:psy-rd=1.0,0.0:no-dct-decimate=1:deblock=0,0:mbtree=1:8x8dct=0:vbv-maxrate=12000:vbv-bufsize=2500:weightp=0
[21:17:35]      + quality: 20.00 (RF)

[21:19:18] work: average encoding speed for job is 58.297890 fps

x264 [info]: SSIM Mean Y:0.9783981
x264 [info]: PSNR Mean Y:42.817 U:48.693 V:48.408 Avg:44.017 Global:43.667 kb/s:2322.39
This brings speed on par with your original settings (a bit faster, actually), while still delivering slightly higher quality at a lower bitrate.

Finally, setting motion estimation to hex instead of diamond:

Code: Select all

[21:19:20]    + encoder: x264
[21:19:20]      + options: ref=1:mixed-refs=0:bframes=0:weightb=0:me=hex:subq=6:analyse=i8x8,i4x4:cabac=0:psy-rd=1.0,0.0:no-dct-decimate=1:deblock=0,0:mbtree=1:8x8dct=0:vbv-maxrate=12000:vbv-bufsize=2500:weightp=0
[21:19:20]      + quality: 20.00 (RF)

[21:21:13] work: average encoding speed for job is 53.138165 fps

x264 [info]: SSIM Mean Y:0.9784166
x264 [info]: PSNR Mean Y:42.821 U:48.694 V:48.408 Avg:44.020 Global:43.670 kb/s:2322.71
A bit slower, but still faster than your original settings. Bitrate is almost the same as previous settings (also lower than your original settings) but quality is improved by a small amount.

Logs: http://handbrake.fr/pastebin/pastebin.php?show=1024

kvaruni
Posts: 56
Joined: Tue Mar 24, 2009 1:12 pm

Re: Best Quality, Small Size And And A Fast Rip

Post by kvaruni » Thu Dec 03, 2009 9:57 pm

Wow, thank you Rodeo,

to be honest, I hand-picked these settings from about 40 different sets that I tested over various RF and I never imagined that they could be further improved. I like it that you set the partitions yourself and I never even considered that this would offer me better compression, speed and file size. I will try your settings in my next batch of encodes, probably tomorrow. In case you know of any other way to tweak these settings, I would be more than happy to hear them! :D

User avatar
Rodeo
HandBrake Team
Posts: 11849
Joined: Tue Mar 03, 2009 8:55 pm

Re: Best Quality, Small Size And And A Fast Rip

Post by Rodeo » Thu Dec 03, 2009 10:15 pm

kvaruni wrote:Wow, thank you Rodeo,

to be honest, I hand-picked these settings from about 40 different sets that I tested over various RF and I never imagined that they could be further improved. I like it that you set the partitions yourself and I never even considered that this would offer me better compression, speed and file size. I will try your settings in my next batch of encodes, probably tomorrow. In case you know of any other way to tweak these settings, I would be more than happy to hear them! :D
I've actually tested the settings on 2-3 other sources, and while the bitrate always went down, I noticed that in some cases the SSIM was a bit lower with the last settings than with your settings. Looking at the files, some frames looked better with your settings and some better with the last settings (in my original test clip, the last settings looked better for every frame I looked at - this is all subjective of course).

Raising ref to 2 seemed to compensate for it (and helped reduce file size too), but then the new settings became a tad slower than your original settings.

kvaruni
Posts: 56
Joined: Tue Mar 24, 2009 1:12 pm

Re: Best Quality, Small Size And And A Fast Rip

Post by kvaruni » Fri Dec 04, 2009 2:17 pm

I have been running through a whole batch of encodes, trying to find some tweaks and I have come up with some results that were rather awkward to me. For reference, let me summarise what we have:

Code: Select all

level=30:ref=2:mixed-refs=1:bframes=0:b-adapt=0:direct=none:weightb=0:b-pyramid=0:me=hex:subq=6:analyse=i8x8,i4x4:8x8dct=0:cabac=0:psy-rd=1.0,0.0:no-fast-pskip=0:no-dct-decimate=1:deblock=0,0:mbtree=1:vbv-maxrate=10000:vbv-bufsize=2500:weightp=0
This is my setting, with fast-pskip off, refs set to 2, mixed-refs turned on again and some analysis. For me, this offers faster encodes , smaller filesizes and better quality for all sources (I tested with animation, computer animation, action, drama ... the whole set). This offers about 0% (action) to 6% (animation) faster encodes, something like 0.0005 (animation) to 0.002 (action) better SSIM on average and a 0% (action) to 6% (animation) decrease in file size. Nice, no hurt, all gain.

I have been messing around with some of the more esoteric settings such as aq-mode, rc-lookahead and no-spy and found that they all decrease size. I went for aq-mode=2 and rc-lookahead=60. Furthermore, they all increase encoding speed, which is nice. Sadly enough, they decrease quality. However, the decrease in size is such that it becomes worthwhile to either decrease RF or turn off mbtree. I prefer the first, but results are very inconsistent and highly depend on the RF you are currently using. Nevertheless, turning off mbtree also has a considerable impact. SSIM seems to get a 0.0001 (animation) to 0.02 (action) hit (i.e. better than my original settings, worse than yours), sees a massive 20%-25% speed increase. File size for animation is between the original and the tweaked settings. For action however, the size drops by a noticeable 15%-20%. I would say that these settings even look better (even though SSIM seems to take a hit), but this is so subjective that I may very well be wrong. So, why don't you give these settings a go and see for yourself and drop me your opinion? Anyway, the speed increase may allow for more advanced settings to be turned on - I have not tried this yet since I wouldn't know what might correct the SSIM by 0.02 - or may allow for RF to still go down a notch. So, for now, I would use these settings with an RF=20:

Code: Select all

level=30:ref=2:mixed-refs=1:bframes=0:b-adapt=0:direct=none:weightb=0:b-pyramid=0:me=hex:subq=6:analyse=i8x8,i4x4:8x8dct=0:cabac=0:psy-rd=1.0,0.0:no-fast-pskip=0:no-dct-decimate=1:deblock=0,0:mbtree=0:vbv-maxrate=10000:vbv-bufsize=2500:weightp=0:rc-lookahead=60:aq-mode=2:no-psy
edit: corrected small error, inadvertently set ref=1 instead of 2.
edit: I tested by adding p8x8 to the analysis, and while file size goes down and SSIM goes up, it does affect encoding speeds considerably, becoming about 20% slower than the original settings.

PS: I know that rc-lookahead affects mbtree and I know that mbtree is off while rc-lookahead has been upped from 40 to 60. This is intentional, since rc-lookahead also affects vbv and allows it to make better predictions, which I think it actually does when looking at some encoded material.

User avatar
Rodeo
HandBrake Team
Posts: 11849
Joined: Tue Mar 03, 2009 8:55 pm

Re: Best Quality, Small Size And And A Fast Rip

Post by Rodeo » Fri Dec 04, 2009 3:19 pm

So now you're disabling mb-tree (which can increase compression efficiency by 0 to 20%).

Also, you can't compare your new settings to your old settings by SSIM since now you're turning off all psy enhancements (no-psy), which happens to include psy-rd. Eeven if the metrics are higher the quality may still be lower.

Moreover, aq-mode 2 will always improve SSIM but not necessarily perceived quality, so that also makes comparisons by SSIM less accurate.

kvaruni
Posts: 56
Joined: Tue Mar 24, 2009 1:12 pm

Re: Best Quality, Small Size And And A Fast Rip

Post by kvaruni » Fri Dec 04, 2009 5:20 pm

Indeed, I know, that is exactly why I am posting it and explicitly asking to give these settings a go and give your opinion on them, in terms of encoded quality. For me the quality seems better, but I am notoriously bad in visually comparing different encodes. Which is exactly why I often run a batch of encodes and submit other people to a double blind test, as this is the most reliable way to establish visual quality. Sadly enough, all my guinea pigs are occupied for the time being, so I am relying on your expertise, if you would be willing to, obviously.

Ah, and actually, SSIM drops consistently whenever I use aq-mode=2.

Post Reply