Page 1 of 1

When to use Deblock on x265?

Posted: Mon Jul 20, 2020 11:18 am
by Scalextrix
Description of problem or question:
When should you use deblock, is it to reduce the typical block-iness in dark scenes. Will setting a higher CRF acheive the same?

HandBrake version (e.g., 1.0.0):
1.3.3

Operating system and version (e.g., Ubuntu 16.04 LTS, macOS 10.13 High Sierra, Windows 10 Creators Update):
Windows 10 1909 x64

Re: When to use Deblock on x265?

Posted: Mon Jul 20, 2020 2:16 pm
by Rodeo
You use a *lower* rate factor (RF) to increase quality. That will reduce compresson artifacts at the expense of a higher output bitrate.

Some such artifacts can also be reduced somewhat by using a 10-bit encoder (even if the source is 8-bit). Ensuring your playback setup (TV, computer monitor, etc.) is properly calibrated also helps (poorly calibrated displays will make some artifacts more obvious where they may be invisible on a well-calibrated one).

The standalone deblock filter, on the other hand, is meant to be used on low quality sources that already have blocking artifacts before encoding (in which case, increasing the quality/bitrate used by the encoder will not help since the artifacts are already there).

Re: When to use Deblock on x265?

Posted: Mon Jul 20, 2020 4:06 pm
by Scalextrix
Thanks for your answer, I set the RF to 19 for my 1080p encodes and that generally gives excellent results, even on the dark scenes, I have 16TB storage so I'm not too worried on file size (a 28GB blu-ray compressed to 7GB is excellent in my book).

I never thought of screen calibration, is that possible with TVs? Have never seen much in the menu's about it.

Re: When to use Deblock on x265?

Posted: Mon Jul 20, 2020 6:31 pm
by musicvid
It depends on whether blocking occurs in the source or output.
The elegant way to reduce output blocking without large file size (lower RF) is to set ABR and Maxrate closer together.
Here's a useful bandwidth compression technique using maxrate and ABR, that enhances detail and reduces blocking in shadows, fades, and transitions.

Background: In the early days of DVD production with VBR, encoders such as Mainconcept had target values specified for Min, Max, and Avg bitrates. The purpose of Minimum bitrate control was to boost suboptimal rendering of low-complexity areas, specifically shadows, fades, and transitions, to prevent large, blocky artifacts from ruining the encode. For instance, 1Mbps Min was usually blocky, while 2Mbps was always clean and free of visible artifacts. It was the one parameter over which bandwidth-centric encoders had a big advantage, perhaps the only one ...​

Unfortunately, with CQ / CRF encoding came the end of Minimum bitrate control. There is no such setting in x264; instead, just a --deblock setting which actually blurs the shadows rather than adding much-needed bits to the mix.​

So, here is a technique that achieves some minimum bitrate control in x264, although indirectly. If we set ABR, maxrate, and bufsize near the same value, both min and max are compressed, removing low-pass blockiness, as well as managing peaks as we discussed earlier. In this example, Minimum bitrate has been raised a whopping 4,700 Kbps, or 35%! This effectively eliminating any possibility of encoder-mediated shadow blocking, as well as capping spikes and maintaing desired ABR This doesn't work with CRF, unfortunately.

Re: When to use Deblock on x265?

Posted: Mon Jul 20, 2020 7:13 pm
by mduell
Rather than reverting to bitrate targets, you can just set the max QP lower with a CRF-targeted encode.