Blocky artifacts in deep shadows

HandBrake for Mac support
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
Silent3
Posts: 16
Joined: Sat Nov 28, 2009 12:11 am

Blocky artifacts in deep shadows

Post by Silent3 »

I've been compressing a lot of standard definition video with Handbrake using H.264, strict anamorphic, decombing, no cropping, Constant Quality RF 18 (so, a bit higher quality than the recommended default for SD video), and pretty much default settings for everything else.

I've been very pleased with the results I've been getting this way... at least until I saw the scene below, and some similar shadowy scenes, in an episode of Babylon 5 (Season 4, Episode 14, "Moments of Transition", for anyone who's curious). The scene looks just fine when I play it on my computer, and this captured still frame will probably look fine to most people looking at it on their computers:

Image
(Garibaldi, grumpily waking up to answer a late-night call.)

I just got a new WD TV Live for my living room, however, and the five-year old Panasonic plasma TV we have there is rendering some deep shadow details that have, until now, been hidden from me. I enhanced the above frame capture in Photoshop to bring out and exaggerate the blocky artifacts that the Panasonic plasma reveals:

Image

Compare the above to a similarly enhanced frame capture from the original MPEG-2 DVD video:

Image

What had been fairly fine-grain noise in the original video has been turned into a blocky mess. When in motion, these blocky patterns shift and change in distracting ways that the original fine-grain noise does not.

My question is this: Although this is clearly a matter of recompression artifacts, is the fact that I'm seeing these artifacts more a fault of the compression method, or more a matter of the way the TV has been adjusted? Am I being shown too much low-level detail? Is the TV going too far in avoiding "black crush" and showing me shadow detail that shouldn't normally be visible, details that the compression algorithm correctly categorized as falling below the normal threshold of visibility?

If the TV isn't at fault, if it's fair to expect this kind of shadow detail to be visible and well-rendered, can I tweak my compression settings to be better at handling this kind of shadow detail without grossly bloating the size of the files I create? What might those tweaks be?

When I look at this particular scene in my home theater, using a JVC RS55 projector and a Popcorn Hour A-400 media player, I can, if I make an effort to look for it, see the extra blockiness from the recompression, but it's not particularly noticeable or distracting.
User avatar
JohnAStebbins
HandBrake Team
Posts: 5723
Joined: Sat Feb 09, 2008 7:21 pm

Re: Blocky artifacts in deep shadows

Post by JohnAStebbins »

I dislike these types of artifacts as well. They are difficult to eliminate without throwing lots of bits at the problem. But I have found that the following x264 settings help.

Preset: medium
Tune: grain
Profile: high
Level: 4.0
Extra Settings: aq-strength=1.4:bframes=4:b-adapt=2

For a given RF, your files will be larger. But you may find that you can raise your RF and still get acceptable quality with these settings. For example, with BD input, I now use an RF of 23 with these settings where I previously used an RF of 19.

Also, mbtree seems to exaggerate these types of artifacts. So disabling mbtree or increasing qcomp (to weaken mbtree) may help.
User avatar
JohnAStebbins
HandBrake Team
Posts: 5723
Joined: Sat Feb 09, 2008 7:21 pm

Re: Blocky artifacts in deep shadows

Post by JohnAStebbins »

I forgot to mention, your TV is probably a little mis-adjusted as well. These artifacts should really be just at the threshold of visibility.
mduell
Veteran User
Posts: 8198
Joined: Sat Apr 21, 2007 8:54 pm

Re: Blocky artifacts in deep shadows

Post by mduell »

JohnStebbins workaround works, but really your TV is miscalibrated or incapable of normal image reproduction.
Silent3
Posts: 16
Joined: Sat Nov 28, 2009 12:11 am

Re: Blocky artifacts in deep shadows

Post by Silent3 »

JohnAStebbins wrote:...I have found that the following x264 settings help...
Thanks. I'll give those settings a try and let you know how it goes.
mduell wrote:JohnStebbins workaround works, but really your TV is miscalibrated or incapable of normal image reproduction.
I think the calibration is indeed a bit off, but please realize those pictures I posted are deliberately a great exaggeration of what I was seeing on my TV. Only by greatly exaggeration the visibility of the effect in Photoshop could I be sure that people viewing this thread could see what I was talking about, as "black crush" is very, very common in the way many people's computer displays are (mal-) adjusted.

The TV has a simple black level setting, but only two options, "light" or "dark", and neither gets it quite right. I can improve the problem by turning down the brightness, but it becomes a trade-off between hiding the noise and a bit more black crush than I'd like.
User avatar
JohnAStebbins
HandBrake Team
Posts: 5723
Joined: Sat Feb 09, 2008 7:21 pm

Re: Blocky artifacts in deep shadows

Post by JohnAStebbins »

What kind of TV is it? Sometimes there are hidden "service" menus that let you do things like adjust the brightness of the LED backlight.
mduell
Veteran User
Posts: 8198
Joined: Sat Apr 21, 2007 8:54 pm

Re: Blocky artifacts in deep shadows

Post by mduell »

JohnAStebbins wrote:What kind of TV is it? Sometimes there are hidden "service" menus that let you do things like adjust the brightness of the LED backlight.
five-year old Panasonic plasma TV
No LEDs there.
Deleted User 13735

Re: Blocky artifacts in deep shadows

Post by Deleted User 13735 »

JohnAStebbins wrote:I dislike these types of artifacts as well. They are difficult to eliminate without throwing lots of bits at the problem.
IMO x264 needs a minimum bitrate control to work together with CRF. Shadows, FTB, and crossfades could benefit from this, without a "lot" more bits.

*I'm going to save those settings as a preset, and try them next time I run into this issue.
Silent3
Posts: 16
Joined: Sat Nov 28, 2009 12:11 am

Re: Blocky artifacts in deep shadows

Post by Silent3 »

Those settings improved the video, but at a large price in file size.

At the same RF I was using before (18) the output file was so close in size to the original 1.91 GB MPEG-2 file that I might as well use the original. By raising the RF to 21 I got the file down to 1.24 GB, but that's still a good bit larger than the 0.73 GB I was getting at RF 18 with other settings at normal defaults. Also, at RF 21, the dark shadow noise started to get blocky again, the main difference being that these blocky patterns changed at a faster, more shimmering pace -- which is some improvement over the more lurching character of the block patterns I was originally getting, but not worth a 70% increase in file size.

Leaving my compression settings alone and adjusting this particular TV to hide these patterns as best as I can seems to be the best solution. I'll have to look into whether I can find some service menu magic to accomplish a bit more tweaking than I can do with the normal controls, since I think my results are revealing some odd linearity problems at the darker end of this TV's luminance response curve.
Deleted User 13735

Re: Blocky artifacts in deep shadows

Post by Deleted User 13735 »

Most TVs crush signals in the 0-6 luminance range, making the adjustment very tricky. Little can be done about this in the setup.
Silent3
Posts: 16
Joined: Sat Nov 28, 2009 12:11 am

Re: Blocky artifacts in deep shadows

Post by Silent3 »

musicvid wrote:Most TVs crush signals in the 0-6 luminance range, making the adjustment very tricky. Little can be done about this in the setup.
What my TV is doing is actually an unhelpful opposite of black crush -- it's showing too much contrast between what should be small steps in black/near-black intensity values, at least when you pick the "light" option for the black level setting. The one other option for that setting, "dark", produces excessive black crush.
Deleted User 13735

Re: Blocky artifacts in deep shadows

Post by Deleted User 13735 »

See if you can borrow a Spyder and calibrate it, starting from factory defaults.
Smithcraft
Veteran User
Posts: 2697
Joined: Thu Jan 22, 2009 8:04 pm

Re: Blocky artifacts in deep shadows

Post by Smithcraft »

First, I know my teevee is out of calibration.

Second, while I am using the grain tune to work around some problems, this addition of "aq-strength=1.4:bframes=4:b-adapt=2" cleaned up my test subject (1st chapter of Skyfall) quite nicely.

I'll have to find my other test file and see what it does with that.

SC
randomreuben
Veteran User
Posts: 468
Joined: Mon Nov 02, 2009 2:18 pm

Re: Blocky artifacts in deep shadows

Post by randomreuben »

Hi JohnAStebbins,

What was the reason for bumping up the bframes to 4 here? Why not 5 or the standard 3? I have been using these settings and I really like the results. I understand the aq-strength adjustment, but not the reason for the b-frames.
JohnAStebbins wrote:I dislike these types of artifacts as well. They are difficult to eliminate without throwing lots of bits at the problem. But I have found that the following x264 settings help.

Preset: medium
Tune: grain
Profile: high
Level: 4.0
Extra Settings: aq-strength=1.4:bframes=4:b-adapt=2

For a given RF, your files will be larger. But you may find that you can raise your RF and still get acceptable quality with these settings. For example, with BD input, I now use an RF of 23 with these settings where I previously used an RF of 19.

Also, mbtree seems to exaggerate these types of artifacts. So disabling mbtree or increasing qcomp (to weaken mbtree) may help.
User avatar
JohnAStebbins
HandBrake Team
Posts: 5723
Joined: Sat Feb 09, 2008 7:21 pm

Re: Blocky artifacts in deep shadows

Post by JohnAStebbins »

Because 5 is too many and 3 is not enough. No particular reason really. I just see from encoding statistics of movies that there are usually as many "4 consecutive" b-frame sequences as there are "3 consecutive" b-frame sequences. So allowing an extra b-frame improves compression by a small margin. I don't go higher because more b-frames can also hurt quality.

I don't have any hard evidence one way or the other whether this is an overall improvement.
Post Reply