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 17th April 2024, 00:06   #1  |  Link
simple_simon
Registered User
 
Join Date: Feb 2003
Posts: 124
x264 Frame Edge Smearing

Is there any way to combat the frame edge smearing in grainy video as seen here?: https://ibb.co/qg5Hjnd

Even using placebo settings don't seem to help.

x265 doesn't seem to have this issue: https://ibb.co/0cytPNm
simple_simon is offline   Reply With Quote
Old 17th April 2024, 09:33   #2  |  Link
blob2500
Registered User
 
Join Date: Sep 2007
Location: Italy
Posts: 30
I think the comparison would have been more genuine between frames of the same size.
blob2500 is offline   Reply With Quote
Old 17th April 2024, 19:54   #3  |  Link
simple_simon
Registered User
 
Join Date: Feb 2003
Posts: 124
Quote:
Originally Posted by blob2500 View Post
I think the comparison would have been more genuine between frames of the same size.
The 32pixel size difference wouldn't have made any difference. x264 consistently smears the right and left edges of the frame on grainy video regardless of frame size or bitrate.
simple_simon is offline   Reply With Quote
Old 19th April 2024, 20:36   #4  |  Link
simple_simon
Registered User
 
Join Date: Feb 2003
Posts: 124
Has anybody else noticed this problem? Is there a solution to prevent it?
simple_simon is offline   Reply With Quote
Old 19th April 2024, 21:31   #5  |  Link
benwaggoner
Moderator
 
Join Date: Jan 2006
Location: Portland, OR
Posts: 4,825
Quote:
Originally Posted by simple_simon View Post
Has anybody else noticed this problem? Is there a solution to prevent it?
Cropping to mod16 (so width and height are both divisible by 16) can help with some edge conditions like this.
__________________
Ben Waggoner
Principal Video Specialist, Amazon Prime Video

My Compression Book
benwaggoner is offline   Reply With Quote
Old 20th April 2024, 04:59   #6  |  Link
simple_simon
Registered User
 
Join Date: Feb 2003
Posts: 124
Quote:
Originally Posted by benwaggoner View Post
Cropping to mod16 (so width and height are both divisible by 16) can help with some edge conditions like this.
You're right, that did help a lot. I guess I had misunderstood something I had read somewhere else that leaving mod16 black bars on the edges would solve the blurriness because that didn't work. But making the total height and width mod16 did. I had to undercrop a little to achieve mod16 because the only other alternatives were to overcrop by too much or have a pretty huge aspect ratio rounding error. There's still some blurriness but not nearly as noticeable as before. I always thought not fully cropping the black borders was the thing that would hurt compression more than it not being mod16.

This seems like a pretty big flaw, I'm surprised it's never been fixed after all these years. I thought one of the benefits of x264 was that the video didn't have to conform to mod16 anymore. Interesting that x265 has seemed to overcome the problem somehow.

I guess now I have to decide whether it's worth it to have to conform to mod16 for x264 or should I just start using x265 instead despite having a much bigger gap in compatibility.
simple_simon is offline   Reply With Quote
Old 20th April 2024, 14:25   #7  |  Link
blob2500
Registered User
 
Join Date: Sep 2007
Location: Italy
Posts: 30
Quote:
Originally Posted by benwaggoner View Post
Cropping to mod16 (so width and height are both divisible by 16) can help with some edge conditions like this.
in fact, for example, I have always used mod 16, and looking through my x264 TV rips, I don't encounter this problem.

For example, in this image it should have been found, but issue isn't there:



(1248 x 672, x264 version r3153 in this case)

Last edited by blob2500; 20th April 2024 at 14:29.
blob2500 is offline   Reply With Quote
Old 24th April 2024, 19:19   #8  |  Link
benwaggoner
Moderator
 
Join Date: Jan 2006
Location: Portland, OR
Posts: 4,825
Quote:
Originally Posted by simple_simon View Post
You're right, that did help a lot. I guess I had misunderstood something I had read somewhere else that leaving mod16 black bars on the edges would solve the blurriness because that didn't work. But making the total height and width mod16 did. I had to undercrop a little to achieve mod16 because the only other alternatives were to overcrop by too much or have a pretty huge aspect ratio rounding error. There's still some blurriness but not nearly as noticeable as before. I always thought not fully cropping the black borders was the thing that would hurt compression more than it not being mod16.
Leaving in black bars doesn't hurt anything as long as they are mod16, but they don't help anything either. Note that 1080p actually isn't mod16, but mod 8. So if you want to do letterboxing, a bottom bar should be +/-8 pixels compared to the top bar to make the encoding mod16.

If you can't do mod16 bars, much better to just crop. H.264 has a sophisticated edge mirroring tool that makes non-mod16 cropping work better than non-mod16 letterboxing.

Quote:
This seems like a pretty big flaw, I'm surprised it's never been fixed after all these years. I thought one of the benefits of x264 was that the video didn't have to conform to mod16 anymore. Interesting that x265 has seemed to overcome the problem somehow.
As long as you crop to the active image area, you don't need to worry about mod16 as much. I try to do at least mod8, but have used mod4 fine without issues (minimum luma block size in H.264 is 4x4, but chroma is 8x8).

Quote:
I guess now I have to decide whether it's worth it to have to conform to mod16 for x264 or should I just start using x265 instead despite having a much bigger gap in compatibility.
Oh, the compatibility gap is much, much smaller these days. Even web browsers (other than Firefox) can play a HEVC .mp4 now if there is a system decoder available.

But x264 should work fine, and certainly will work a lot better, if you crop to active image area.
__________________
Ben Waggoner
Principal Video Specialist, Amazon Prime Video

My Compression Book
benwaggoner is offline   Reply With Quote
Old 25th April 2024, 20:35   #9  |  Link
simple_simon
Registered User
 
Join Date: Feb 2003
Posts: 124
Quote:
Originally Posted by benwaggoner View Post
As long as you crop to the active image area, you don't need to worry about mod16 as much. I try to do at least mod8, but have used mod4 fine without issues (minimum luma block size in H.264 is 4x4, but chroma is 8x8).
That's what I thought and have been doing mod4 encodes which all look great most of the time. The only issue is that heavily grained sources seem to get the edges of the frame blurred for some reason. It seems to be more noticable on the sides rather than top or bottom and much more noticeable on non-widescreen aspect ratios too for some reason. I haven't been able to find any x264 setting that reduces the blurring either.

It seems the only choices are to denoise and lose the overall look of the source or just live with the blurred edges. The fact that no x264 setting seems to change the blurriness (either making it worse or better) seems weird though. It just seems like a flaw that's been overlooked.
simple_simon is offline   Reply With Quote
Old 26th April 2024, 23:54   #10  |  Link
benwaggoner
Moderator
 
Join Date: Jan 2006
Location: Portland, OR
Posts: 4,825
Quote:
Originally Posted by simple_simon View Post
That's what I thought and have been doing mod4 encodes which all look great most of the time. The only issue is that heavily grained sources seem to get the edges of the frame blurred for some reason. It seems to be more noticable on the sides rather than top or bottom and much more noticeable on non-widescreen aspect ratios too for some reason. I haven't been able to find any x264 setting that reduces the blurring either.
Are you seeing this with or without black borders?

Quote:
It seems the only choices are to denoise and lose the overall look of the source or just live with the blurred edges. The fact that no x264 setting seems to change the blurriness (either making it worse or better) seems weird though. It just seems like a flaw that's been overlooked.
If you try mod8 or mod16, does that improve anything?

And can you share an example screen shot? If only active image area is being encoded and you're seeing the appearing on both sides instead of just the right suggests in may not be a mod issue.

I have seen something like this in old SD sources where the horizontal blanking interval was left in (generally a somewhat rough border between black and image). Cropping 720x to 704x eliminates the problem for the most part (not always with VHS sources), and is best practice. The common 4:3 and 16:9 SAR are defined relative to 704x, not 720x.
__________________
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 10:14.


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