How to determine my proper RF level?

General questions or discussion about HandBrake, Video and/or audio transcoding, trends etc.
Post Reply
paulanderegg
Posts: 14
Joined: Sat Oct 06, 2018 9:27 pm

How to determine my proper RF level?

Post by paulanderegg » Sat Oct 06, 2018 9:35 pm

I am looking to transcode h264 original media files, typically 100Mbps 8 bit 4K HDR clips rendered as 10 bit ProRes, just to get the HDR trigger flag into h265. I typically do average bitrate when converting these to 10 bit HEVC h265, at a bitrate of 60,000 (60Mbps). I throw in an extra 10Mbps to account for the 10 bit conversion, in the hopes my final transcode will be as close to the original file in quality as possible. Doing this with 2 pass average now, but interested in the Constant quality RF system. I've googled in the past, but other than the lower the number the better the quality, I am pretty much unable to determine which number to use.

So for basic h264 to h265, wishing to cut my file to half the size but same quality, how do I determine the best RF? Is there some mathematical formula/graph that shows different RF levels for different resolutions or something?

Paul

mduell
Veteran User
Posts: 6191
Joined: Sat Apr 21, 2007 8:54 pm

Re: How to determine my proper RF level?

Post by mduell » Sat Oct 06, 2018 11:52 pm

Quality based encoding means the bitrate will depend heavily on the content (motion, grain, etc). As an example, Saving Private Ryan is about 15x the bitrate of The Social Network at the same quality and other settings. So there inherently can't be a formula for halving the size given an arbitrary input.

A good way to determine the right RF for you for this specific purpose is to use the slowest preset you can tolerate the encoding time of (which, especially with 4K x265, might be one of the faster ones), and then try the RF values 20-35 in increments of 3. Watch (preferably blind/randomized) all the clips (don't pixel peep stills) back to back or side by side with the original. Pick the RF value where you can see differences (or you can see differences that are unacceptable to you), and then use the RF value 3 points lower for all your subsequent encodes.

Also note HB doesn't support HDR. You might be able to manually flag it.

paulanderegg
Posts: 14
Joined: Sat Oct 06, 2018 9:27 pm

Re: How to determine my proper RF level?

Post by paulanderegg » Sun Oct 07, 2018 12:34 am

So, what you are saying is that I can create a test clip to determine the best RF, using a sample clip with both moving and still content, which could be used as my future baseline RF for future h264 to h265 transcodes...assuming different test clips for 4K 1080p etc? I find things with plants and leaves to be the best pixel peep for annoying artifacts.

And HB does indeed support HDR...if I throw a flagged HDR in 10bit HDR10 PQ or HLG, it will passthrough the metadata properly, and the resulting file will trigger HDR mode on a 4K TV. I can see the BT2020, HLG BT2084 etc listed under codec details on VLC on files I have transcoded using HB. Unfortunately, VLC cannot really playback 4K HDR HEVC files at this time...at least not further than a few frames, then frozen video with audio continuing. You must use 10 bit HEVC for most TV's and other devices to trigger HDR mode...most TV's won't accept 8 bit anything or 10 bit h264 as a valid file type for HDR.

Paul

musicvid
Veteran User
Posts: 3134
Joined: Sat Jun 27, 2009 1:19 am

Re: How to determine my proper RF level?

Post by musicvid » Sun Oct 07, 2018 11:52 pm

1. No, the fingerprint of each source is unique. Your sample will not agree with your program on "best" encoding at ant RF value, unless your muses are in perfect alignment.

2. If you are convinced that Handbrake honors REC 2020 10 bit door to door, then glory be to you. The developers don't actually agree with you yet. Search tool is your friend.

mduell
Veteran User
Posts: 6191
Joined: Sat Apr 21, 2007 8:54 pm

Re: How to determine my proper RF level?

Post by mduell » Mon Oct 08, 2018 12:05 am

paulanderegg wrote:
Sun Oct 07, 2018 12:34 am
So, what you are saying is that I can create a test clip to determine the best RF, using a sample clip with both moving and still content, which could be used as my future baseline RF for future h264 to h265 transcodes...assuming different test clips for 4K 1080p etc? I find things with plants and leaves to be the best pixel peep for annoying artifacts.
Yes, you should test with representative examples.

Yes, you'll find different RF values for different resolutions.

No, you should not pixel peep, that's not how people watch video.

paulanderegg
Posts: 14
Joined: Sat Oct 06, 2018 9:27 pm

Re: How to determine my proper RF level?

Post by paulanderegg » Mon Oct 08, 2018 12:20 am

Well, I used the RF to narrow down 16 as resulting in roughly 55Mbps HEVC video bitrate, so I am going with that.

As for HDR, I transcode ALL the HDR clips I upload to YouTube using HandBrake...I did some more recent tests and found YouTube will flag 8 bit HEVC HLG and HDR10 files as HDR. If someone uses the search tool and sees responses telling them they cannot use Handbrake to transcode HDR clips, then they would be misinformed. See below for a simple HDR10 file I transcoded last month using HB. Since there seems to be a misunderstanding regarding HDR passthrough in HB, maybe I will start a new topic. :-)

https://youtu.be/mKPqMJ1WaJM

*YouTube will accept 8 and 10 bit HEVC, and 10 bit h264 for HDR, but 8 bit h264 out of HB will not playback on the site.
musicvid wrote:
Sun Oct 07, 2018 11:52 pm
1. No, the fingerprint of each source is unique. Your sample will not agree with your program on "best" encoding at ant RF value, unless your muses are in perfect alignment.

2. If you are convinced that Handbrake honors REC 2020 10 bit door to door, then glory be to you. The developers don't actually agree with you yet. Search tool is your friend.

paulanderegg
Posts: 14
Joined: Sat Oct 06, 2018 9:27 pm

Re: How to determine my proper RF level?

Post by paulanderegg » Mon Oct 08, 2018 12:32 am

nmkspx.jpg
Handbrake transcoded HDR video data
You do not have the required permissions to view the files attached to this post.
Last edited by Rodeo on Mon Oct 08, 2018 2:38 pm, edited 1 time in total.
Reason: Convert picture to attachment

paulanderegg
Posts: 14
Joined: Sat Oct 06, 2018 9:27 pm

Re: How to determine my proper RF level?

Post by paulanderegg » Mon Oct 08, 2018 12:35 am

Sorry, I have no clue how to get a picture onto this forum.

Paul

paulanderegg
Posts: 14
Joined: Sat Oct 06, 2018 9:27 pm

Re: How to determine my proper RF level?

Post by paulanderegg » Thu Oct 11, 2018 12:54 am

Well, I apparently didn't realize the speed slider had a drastic effect on resulting bitrate of the files with the same RF. So that pretty much takes RF encoding off my list of usable resources unless someone has a bright idea?

Again, I am looking to get the practically identical quality of my original 100Mbps 8 bit 4:2:0 h264 video files 4K HDR, into 10 bit HEVC files for archiving and playback on TV and media players that require 10 bit to trigger HDR. HEVC has roughly 50% reduction in bit rate to achieve identical quality, and 10 bit from what I have read is a 20% overhead for data, so I settled on 60Mbps HEVC for final transcodes. For now, I have been setting average bitrate to 60,000, multi-pass, and basically just starting an encode and dealing with whatever speed on the slider results in a comfortable enough wait, typically an hour or two. If there is a better quality alternative in RF that can result in better quality 60Mbps HEVC file output, in half the time, I am all ears.

Paul

paulanderegg
Posts: 14
Joined: Sat Oct 06, 2018 9:27 pm

Re: How to determine my proper RF level?

Post by paulanderegg » Thu Oct 11, 2018 1:09 am

On other thing, is there a link someone may have handy to the quality options that get enabled or disabled for the slider speed presets? Thanks!

I found this link, but can anyone advise if the RF is affected by input file bitrate? In other words, would a file double or quadruple the bitrate, but the same specs otherwise, result in a different file size output, double, quadruple etc?

https://mattgadient.com/2014/01/06/hand ... craziness/

Paul

mduell
Veteran User
Posts: 6191
Joined: Sat Apr 21, 2007 8:54 pm

Re: How to determine my proper RF level?

Post by mduell » Thu Oct 11, 2018 2:14 am

paulanderegg wrote:
Thu Oct 11, 2018 12:54 am
Well, I apparently didn't realize the speed slider had a drastic effect on resulting bitrate of the files with the same RF. So that pretty much takes RF encoding off my list of usable resources unless someone has a bright idea?
Yes, constant RF encoding is not the same quality across different presets; that's why I started my advice in my first reply with "use the slowest preset you can tolerate the encoding time of". Pick your speed preset, then find your ideal RF for quality/bitrate tradeoff.
paulanderegg wrote:
Thu Oct 11, 2018 12:54 am
Again, I am looking to get the practically identical quality of my original 100Mbps 8 bit 4:2:0 h264 video files 4K HDR, into 10 bit HEVC files for archiving and playback on TV and media players that require 10 bit to trigger HDR. HEVC has roughly 50% reduction in bit rate to achieve identical quality, and 10 bit from what I have read is a 20% overhead for data, so I settled on 60Mbps HEVC for final transcodes. For now, I have been setting average bitrate to 60,000, multi-pass, and basically just starting an encode and dealing with whatever speed on the slider results in a comfortable enough wait, typically an hour or two. If there is a better quality alternative in RF that can result in better quality 60Mbps HEVC file output, in half the time, I am all ears.
You're making all sorts of terrible assumptions that don't reflect how anything works based on, at best, vague marketing claims.

The best advice for your goal of reducing typical filesize while maintaining adequate quality is still to follow the directions in my first reply.
paulanderegg wrote:
Thu Oct 11, 2018 1:09 am
On other thing, is there a link someone may have handy to the quality options that get enabled or disabled for the slider speed presets? Thanks!
They're largely efficiency options, with various non-obvious quality impacts. They're all documented here.
This is why my first advice started with "use the slowest preset you can tolerate the encoding time of".
paulanderegg wrote:
Thu Oct 11, 2018 1:09 am
I found this link, but can anyone advise if the RF is affected by input file bitrate? In other words, would a file double or quadruple the bitrate, but the same specs otherwise, result in a different file size output, double, quadruple etc?
No, it is not; for a given decoded picture, the x265 encoder has no idea how many bits were used to represent the previously compressed bitstream.
The blog you linked to is typical confused blog crap with no understanding of the x264/x265 quality system or speed presets.
Last edited by mduell on Thu Oct 11, 2018 3:09 am, edited 1 time in total.

paulanderegg
Posts: 14
Joined: Sat Oct 06, 2018 9:27 pm

Re: How to determine my proper RF level?

Post by paulanderegg » Thu Oct 11, 2018 2:41 am

Thanks for the link md!

Most of my working video acquisition is done on Sony XAVC-L 50/100Mbps camera systems, which use average/constant bitrate. My assumptions are mostly centered around keeping that "envelope" of quality to encompass the data from the raw files. I should be able to comprehend the CLI interface in about 10 years at the rate I am learning things. :-)

Looks like maybe I just need to pick some speeds on the slider I am comfortable with, and mess with the RF until I visually see artifacts or noticeable loss of quality. I am a person who uses a meter to calibrate the 10 point on my TV, so the trial and error method of staring at a screen gives me a headache already. Time to put HB in the drivers seat and let it do its magic? :-D

Paul

User avatar
BradleyS
Moderator
Posts: 1427
Joined: Thu Aug 09, 2007 12:16 pm

Re: How to determine my proper RF level?

Post by BradleyS » Fri Oct 12, 2018 1:47 pm

There is little correlation between the bit rate a camera needs and the bit rate needed for a quality archive in post.

Your (professional!) camera is a low power, portable device with a real time hardware encoder that only makes use of basic encoder features and throws bits at the problem to achieve good quality.

Your post production tools like HandBrake have essentially unlimited power and time to crunch the numbers using advanced encoder features and the fewest number of bits possible.

In short, by settling on 60 Mbps HEVC, you are basically confusing the latter scenario with the former. One can certainly achieve stellar 4K quality in half that or less, given an appropriately slow encoder preset and patience.

Post Reply