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 > High Efficiency Video Coding (HEVC)

Reply
 
Thread Tools Search this Thread Display Modes
Old 19th July 2020, 15:47   #1  |  Link
Atlantis
Registered User
 
Join Date: Feb 2002
Posts: 758
Resolution Mod 4

The more you do encoding and learn, the more you find new flaws. Ignorance is bliss!

Recently I realized again I have been encoding wrong. This time about cropping. I always wanted to go mod 2 for resolution but always said, to be on the safe side, I will go mod 4.

Now I see that even mod 4 is not good enough. This is especially visible on TV and less on PC. For example for a 1920 x 804 video, you see a distorted last line on the button. Only trained eyes will notice it, especially visible with lines with an angle.

So I realized that I should go mod 8 not to get that bottom line distortion. To my eyes, I don't see difference with mod 8 or mod 16. Should I go mod 16?

What are your experiences? Is this more visible in H265 encoding? Does this exist in H264 also?
Atlantis is offline   Reply With Quote
Old 19th July 2020, 16:24   #2  |  Link
microchip8
ffx264/ffhevc author
 
microchip8's Avatar
 
Join Date: May 2007
Location: /dev/video0
Posts: 1,843
I always encode to mod 4 and do not see such a line. Never have, not on TV and not on monitor
__________________
ffx264 || ffhevc || ffxvid || microenc
microchip8 is offline   Reply With Quote
Old 19th July 2020, 18:52   #3  |  Link
Boulder
Pig on the wing
 
Boulder's Avatar
 
Join Date: Mar 2002
Location: Finland
Posts: 5,718
That must be a decoder issue. I've never had problems with mod-4 resolutions that I use all the time.
__________________
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 19th July 2020, 22:18   #4  |  Link
Atlantis
Registered User
 
Join Date: Feb 2002
Posts: 758
It is indeed hardware dependent also. For example I have an Amlogic CoreELEC that amplifies the problem and it's easily visible. But it is there, less visible, you have to pixel hunt and once you see it, you never unsee it. I'm definitely leaving mod 4 behind and go mod 8. I will see if I can do screengrabs.
Atlantis is offline   Reply With Quote
Old 20th July 2020, 19:08   #5  |  Link
benwaggoner
Moderator
 
Join Date: Jan 2006
Location: Portland, OR
Posts: 4,750
I generally only do mod4 for square pixel frame sizes below 640x480. mod8 up through 1080p, and then mod16 for higher.

In theory mod2 should work fine with modern codecs. Alas, it's hard to test that something works on everything.
__________________
Ben Waggoner
Principal Video Specialist, Amazon Prime Video

My Compression Book
benwaggoner is offline   Reply With Quote
Old 20th July 2020, 22:58   #6  |  Link
Atlantis
Registered User
 
Join Date: Feb 2002
Posts: 758
So I did a little search and this thing is a little more complicated. There is indeed a hardware limitation in Amlogic hardware that does not show mod 4 videos correctly. It supposedly repeats the last lines to make it mod 8.

But this caused me to look a little closer at the encodes on PC and I see a second different issue. This happens at the edges of the video where the black lines start.

Even if I do a perfect mod 16 crop on picture, I see a little artifact on the last line. It's not 100% smooth. So in some cases I find that if I keep a little more black lines, the encodes are better on the edges. Have you seen this? What is this encode difficulty at the edges of the video?
Atlantis is offline   Reply With Quote
Old 20th July 2020, 23:02   #7  |  Link
Atlantis
Registered User
 
Join Date: Feb 2002
Posts: 758
Quote:
Originally Posted by benwaggoner View Post
In theory mod2 should work fine with modern codecs. Alas, it's hard to test that something works on everything.
Yes, on PC mod 2 works but in the real world with so many hardware decoders, I think mod 8 is the safe way to go.

Last edited by Atlantis; 20th July 2020 at 23:19.
Atlantis is offline   Reply With Quote
Old 21st July 2020, 16:07   #8  |  Link
benwaggoner
Moderator
 
Join Date: Jan 2006
Location: Portland, OR
Posts: 4,750
Quote:
Originally Posted by Atlantis View Post
Even if I do a perfect mod 16 crop on picture, I see a little artifact on the last line. It's not 100% smooth. So in some cases I find that if I keep a little more black lines, the encodes are better on the edges. Have you seen this? What is this encode difficulty at the edges of the video?
Are you sure you cropped tight enough to make sure it's 100% full brightness pixels at the bottom edge?

I can imagine cases where if letterboxing is mod4 or even mod2, AMP would help in making that bottom line solid. But if it is dimmer from being from the edge, you could get some weirdness.
__________________
Ben Waggoner
Principal Video Specialist, Amazon Prime Video

My Compression Book
benwaggoner is offline   Reply With Quote
Old 21st July 2020, 22:26   #9  |  Link
Atlantis
Registered User
 
Join Date: Feb 2002
Posts: 758
These are very subtle things that only zooming in on PC and pixel hunting will show them. It is not visible on TV. I suppose I shouldn't even go down this path but it's "fun" and I have discovered even stranger things!

Discovered that if you just add 4 lines, 2 on the top and 2 on the bottom to go from mod 4 to mod 8 (1920 x 804 to 1920 x 808) the entire encode looks different and not just the edges. Even in the middle of the picture it is different. The mod 8 encode looks better, sharper with less artifacts than the mod 4 encode!
Atlantis is offline   Reply With Quote
Old 26th July 2020, 19:09   #10  |  Link
Atlantis
Registered User
 
Join Date: Feb 2002
Posts: 758
I just realized something after all these years and it blew my mind! 1080 is not mod 16! I always thought that the Bluray resolution is divisible by 16. I always thought they go for mod16.
Atlantis is offline   Reply With Quote
Old 26th July 2020, 19:16   #11  |  Link
Sharc
Registered User
 
Join Date: May 2006
Posts: 3,997
The coded size is actually 1920x1088. The display size is 1920x1080 for 16:9 DAR.
Sharc is offline   Reply With Quote
Old 26th July 2020, 21:58   #12  |  Link
Atlantis
Registered User
 
Join Date: Feb 2002
Posts: 758
Wow, that explodes my mind even more. Please explain that. What that means exactly? What do you mean the coded size?
Atlantis is offline   Reply With Quote
Old 26th July 2020, 22:52   #13  |  Link
Sharc
Registered User
 
Join Date: May 2006
Posts: 3,997
The encoder uses internally 16x16 macroblocks and pads the source to 1920x1088. For playback the 'excess' vertical pixels are just cropped off so you won't see these.
Sharc is offline   Reply With Quote
Old 26th July 2020, 23:40   #14  |  Link
Atlantis
Registered User
 
Join Date: Feb 2002
Posts: 758
Do you mean that in the finished video file present on the bluray, there are 8 more vertical lines? If yes, these are image information or black lines and how come media info still says it's 1080.
Atlantis is offline   Reply With Quote
Old 26th July 2020, 23:49   #15  |  Link
Sharc
Registered User
 
Join Date: May 2006
Posts: 3,997
Yes, 8 extra black lines ar encoded in the frame. They are discarded by MediaInfo and most other tools, as there is no practical use case or standard for 1920x1088. It is just more efficient for the encoding process.
Sharc is offline   Reply With Quote
Old 27th July 2020, 02:14   #16  |  Link
benwaggoner
Moderator
 
Join Date: Jan 2006
Location: Portland, OR
Posts: 4,750
Quote:
Originally Posted by Sharc View Post
Yes, 8 extra black lines ar encoded in the frame. They are discarded by MediaInfo and most other tools, as there is no practical use case or standard for 1920x1088. It is just more efficient for the encoding process.
...and it's been that way for decades, including ATSC 1080i MPEG-2 and Blu-ray. Modern codecs with variable block sizes make non-mod 16 more efficient.
__________________
Ben Waggoner
Principal Video Specialist, Amazon Prime Video

My Compression Book
benwaggoner is offline   Reply With Quote
Old 27th July 2020, 08:17   #17  |  Link
Atlantis
Registered User
 
Join Date: Feb 2002
Posts: 758
So if you take a 4K file or a larger file and crop it to 1088 with image (no black lines), everything discards the extra 8 lines? Or is it a flag that says discard it?
Atlantis is offline   Reply With Quote
Old 27th July 2020, 08:28   #18  |  Link
Sharc
Registered User
 
Join Date: May 2006
Posts: 3,997
Why don't you just try and see what you get with "everything"?
When you crop a 4k file to 1088 it will become 1088. The subsequent steps depend on the encoding SW + authoring SW + player + media (e.g. Blu-ray) constraints.

Last edited by Sharc; 27th July 2020 at 08:44.
Sharc is offline   Reply With Quote
Old 27th July 2020, 20:39   #19  |  Link
benwaggoner
Moderator
 
Join Date: Jan 2006
Location: Portland, OR
Posts: 4,750
Quote:
Originally Posted by Sharc View Post
Why don't you just try and see what you get with "everything"?
When you crop a 4k file to 1088 it will become 1088. The subsequent steps depend on the encoding SW + authoring SW + player + media (e.g. Blu-ray) constraints.
I expect that many players won't know what to do with real 1088p content, since that's super-HD and not something really seen in the wild. An interesting experiment, but nothing I'd do with my own content.

And there really isn't any quality drawback do doing mod8 versus mod16 post MPEG-2. H.264 and later have mirroring features to eliminate the quality issues from having a sharp black edge at the bottom of the encoded region.
__________________
Ben Waggoner
Principal Video Specialist, Amazon Prime Video

My Compression Book
benwaggoner is offline   Reply With Quote
Old 27th July 2020, 20:51   #20  |  Link
Boulder
Pig on the wing
 
Boulder's Avatar
 
Join Date: Mar 2002
Location: Finland
Posts: 5,718
Quite a lot of Blu-ray releases have these strange bright one or two pixel high artifact lines on top or bottom of the frame.
__________________
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
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:11.


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