Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Video Encoding > MPEG-4 AVC / H.264

Reply
 
Thread Tools Search this Thread Display Modes
Old 3rd November 2022, 01:14   #1  |  Link
simple_simon
Registered User
 
Join Date: Feb 2003
Posts: 106
x264 blurring along outside edge of frame

I try to maintain at least mod4 dimensions when cropping while attempting to minimize aspect ratio errors. Sometimes that means not cropping out the black bars completely. However I've noticed that x264 blurs the edges of the frame when there is any amount of black border present (see attached screenshot). I get the same results no matter what settings I use. I don't remember this being an issue before. Is this a new problem with newer builds and is there an older build I can roll back to that didn't have this problem?
Attached Images
 

Last edited by simple_simon; 3rd November 2022 at 03:15.
simple_simon is offline   Reply With Quote
Old 4th November 2022, 06:23   #2  |  Link
rwill
Registered User
 
Join Date: Dec 2013
Posts: 349
It has always been like that.
rwill is offline   Reply With Quote
Old 4th November 2022, 09:54   #3  |  Link
mp3dom
Registered User
 
Join Date: Jul 2003
Location: Italy
Posts: 1,135
Yep, especially noticeable on video with grain.
mp3dom is offline   Reply With Quote
Old 4th November 2022, 13:38   #4  |  Link
simple_simon
Registered User
 
Join Date: Feb 2003
Posts: 106
Hmmm. Strange I never noticed it before. Is there any workaround? Avisynth filter? Is it better to just crop all the borders then and encode mod2? The tricky part with that would be when the aspect ratio isn't consistent, I'd either need to crop out part of the image on wider AR's to make it uniform or only crop to the widest AR and have blurring on the edges when the AR got narrower.
simple_simon is offline   Reply With Quote
Old 4th November 2022, 17:11   #5  |  Link
mp3dom
Registered User
 
Join Date: Jul 2003
Location: Italy
Posts: 1,135
The workaround is to remove all the black on the top/bottom bars or have a mod16 black bars. Since you have 16x16 macroblocks, if the macroblock is full black, there's no issue. The problem arise when in a 16x16 macroblock you have some rows with constant black pixels. In those cases, it seems that x264 gets "fooled" and assigns to the macroblock a way higher quantizer, not enough to preserve quality.

Last edited by mp3dom; 4th November 2022 at 17:13.
mp3dom is offline   Reply With Quote
Old 4th November 2022, 17:40   #6  |  Link
Boulder
Pig on the wing
 
Boulder's Avatar
 
Join Date: Mar 2002
Location: Finland
Posts: 5,733
This phenomenon is clearly visible in quite a few commercial encodes as well.
__________________
And if the band you're in starts playing different tunes
I'll see you on the dark side of the Moon...
Boulder is offline   Reply With Quote
Old 4th November 2022, 21:22   #7  |  Link
LoRd_MuldeR
Software Developer
 
LoRd_MuldeR's Avatar
 
Join Date: Jun 2005
Location: Last House on Slunk Street
Posts: 13,248
I think this is a general "problem", if you have a very sharp edge that is not aligned with a 16×16 macro-block boundary.

Accurately preserving a very sharp edge somewhere in the middle of a macro-block would be incredibly expensive, in terms of bit cost.

And since we only have a limited "budget" of bits, these bits probably are spent better somewhere else in the frame
__________________
Go to https://standforukraine.com/ to find legitimate Ukrainian Charities 🇺🇦✊

Last edited by LoRd_MuldeR; 4th November 2022 at 21:30.
LoRd_MuldeR is offline   Reply With Quote
Old 4th November 2022, 21:52   #8  |  Link
VoodooFX
Banana User
 
VoodooFX's Avatar
 
Join Date: Sep 2008
Posts: 989
Quote:
Originally Posted by simple_simon View Post
x264 blurs the edges of the frame when there is any amount of black border present (see attached screenshot)
I don't see black border in your screenshot.
VoodooFX is offline   Reply With Quote
Old 5th November 2022, 14:23   #9  |  Link
mp3dom
Registered User
 
Join Date: Jul 2003
Location: Italy
Posts: 1,135
Quote:
Originally Posted by LoRd_MuldeR View Post
I think this is a general "problem", if you have a very sharp edge that is not aligned with a 16×16 macro-block boundary.
[...]
And since we only have a limited "budget" of bits, these bits probably are spent better somewhere else in the frame
Yes, but this problem is not so extremely visible with other encoders, in an extent that with just this kind of screenshot I can clearly say "ok, this was encoded with x264". At bluray bitrates this loss of details is more visible than some bits spent elsewhere because it's persistent on the whole movie.

This and the other issue (bitrate and quality drop after a very complex scene when vbv is in use) are the real two issues of x264. Unfortunately, I guess they will never be (at least) mitigated or (even better) fixed.
mp3dom is offline   Reply With Quote
Old 5th November 2022, 15:46   #10  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 5,377
It's also one of the side effects of AQ - bits are taken not only from object edges ("halo" of smoothness around objects), but also frame edges ("halo" of smoothness around frame borders). Does anyone recall the AQ tests on the grainy Island trailer ~15 years ago?

You can reduce the effect at a given bitrate by reducing the AQ strength, and/or using higher bitrates
poisondeathray is offline   Reply With Quote
Old 5th November 2022, 21:50   #11  |  Link
mp3dom
Registered User
 
Join Date: Jul 2003
Location: Italy
Posts: 1,135
Quote:
Originally Posted by poisondeathray View Post
You can reduce the effect at a given bitrate by reducing the AQ strength, and/or using higher bitrates
Well, I'm not sure about using higher bitrates. This problem is exactly the same (same flattest macroblock problem and detail loss) even at bluray bitrates (I mean, a 35 Mbps average). In a grainy source (not extremely grainy, just a standard film-grain) this is still clearly visible. I can't recall another encoder that at these bitrates exhibits the same problem or with this same amount.

Last edited by mp3dom; 7th November 2022 at 23:14.
mp3dom is offline   Reply With Quote
Old 7th November 2022, 18:43   #12  |  Link
benwaggoner
Moderator
 
Join Date: Jan 2006
Location: Portland, OR
Posts: 4,770
Note that 1080p is not mod16. Internally it is 1088 tall with 8 "dummy" lines at the bottom. So to get mod16 when framing into 1080, you want mod16 from the top, and mod16 -8 from the bottom.

Better to just crop to active image area if targeting a format that allows that.
__________________
Ben Waggoner
Principal Video Specialist, Amazon Prime Video

My Compression Book
benwaggoner is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 01:44.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.