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. |
17th November 2021, 07:51 | #1 | Link |
Video Fanatic
Join Date: Jul 2021
Location: Surrey
Posts: 89
|
Still trying to work out x265's 'static grain' issue
It's really hard to demonstrate this with anything other than high quality video, but ever since using x265, I've found that grain is treated very differently - which makes sense - apart from when there is a medium grainy scene with moving content (people in a nightclub) and the grain seems 'stick' around the moving person, yet appear normal/transparent (CRF 16/1080p) everywhere else.
With my new CPU, I have decided to start encoding Supernatural (retail Blu-ray release, with heavy grain in earlier seasons) in 1080p and even setting a CRF of 16 and --tune grain (+disabling SAO) sees the problem persist. Even setting a CRF so low that the output is higher than the source seems the problem persist. I realise without video to see the issue, it's hard to explain, but the best way I can describe is a sort of fuzz around moving objects such as a person. SAO removes this issue, but also removes grain/perceived detail. If you had a very grainy source (which could have done with more bitrate from the studio), what would you do? I can then produce a test encode. Edit: I would be happy to produce 2 test encodes - one with recommended flags and one with --tune grain -- both at three-pass 6000kbps and then clip 30s from the three clips (source, encode 1, encode 2) to post here (if the rules allow, which is uncertain). Edit: I have provided 15s video examples in this post.
__________________
PC: R9 5900X | 32GB 3600 MT/s RAM | 2*1TB NVMe | RTX 3080 | water-cooled NAS: SM 48-bay 240TB+ storage | Xeon 1220 | 32GB DDR4 ECC HTPC: Pentium J5005 | 16GB RAM | 256GB SSD | 15W Last edited by tonemapped; 19th November 2021 at 14:25. |
17th November 2021, 23:05 | #2 | Link |
Moderator
Join Date: Jan 2006
Location: Portland, OR
Posts: 4,929
|
--tune grain is a pretty thermonuclear option these days. It was required to get decent grain quality with x265 back 4-5 years ago, but grain handling has been much improved even without it. And --tune grain takes a lot of bits. it's possible you're still seeing quality issues at --crf 16 because VBV limits are kicking in with QP spikes in that region (you'll see that if ABR is getting close to your peak bitrate). And it's slow without rskip.
Can you share your full command line? Were I to make a new "does well with most grain" setting today, I might start with: --preset slower --ipratio 1.2 --pbratio 1.1 --no-sao --hme --rskip 2 --psy-rd 3 --psy-rdoq 8 --nr-inter 100 --tskip --tskip-fast |
18th November 2021, 14:36 | #3 | Link |
Pig on the wing
Join Date: Mar 2002
Location: Finland
Posts: 5,812
|
I'd simply try --preset slower --no-sao --deblock -1:-1 --rskip 2 --rskip-edge-threshold 2 --psy-rd 4 --psy-rdoq 15 --aq-mode 1 and see how it looks.
Of course, it would help to see a sample of the source video.
__________________
And if the band you're in starts playing different tunes I'll see you on the dark side of the Moon... |
19th November 2021, 01:15 | #4 | Link |
Registered User
Join Date: May 2009
Posts: 344
|
I refuse to encode anything with noticeable grain, in HEVC. H.264 is still far superior. AV1 is supposed to be better, eventually, but until that happens, I'll just keep remuxing grainy sources and storing the discs on a shelf.
|
19th November 2021, 01:47 | #5 | Link | |
Moderator
Join Date: Jan 2006
Location: Portland, OR
Posts: 4,929
|
Quote:
So it's not encoding the grain better, but degraining the source, parameterizing the removed grain, encoding, and putting the parameters into metadata. On playback the degrained frames are decoded and the parameters fed into a grain synthesis filter to generate new grain which hopefully looks like the original grain. Which is utterly brilliant and should drop bitrates by >50% for grainy content! But it's not like we've figured out optimal fully automated grain removal and parameterization technology! And that is out-of-band of the actual codec itself, and not something codec engineers are particularly skilled with or interested in. During AV1 development it was largely a "and someone else can implement..." feature. I'm not aware of anyone actually using FGS in deployed AV1 yet. A cool thing is that the degraining process, metadata, and grain synthesis tech is all codec agnostic. SoC vendors are implementing it generically, so any AV1 decode capable HW should be able to use the same technique with HEVC, VVC, AV2, etc. |
|
19th November 2021, 07:18 | #8 | Link | |
Video Fanatic
Join Date: Jul 2021
Location: Surrey
Posts: 89
|
Quote:
__________________
PC: R9 5900X | 32GB 3600 MT/s RAM | 2*1TB NVMe | RTX 3080 | water-cooled NAS: SM 48-bay 240TB+ storage | Xeon 1220 | 32GB DDR4 ECC HTPC: Pentium J5005 | 16GB RAM | 256GB SSD | 15W Last edited by tonemapped; 19th November 2021 at 09:30. Reason: Updated encoding fps |
|
19th November 2021, 13:21 | #9 | Link |
Video Fanatic
Join Date: Jul 2021
Location: Surrey
Posts: 89
|
The encode has completed and I mistakenly used CRF rather than two- or three-pass for it, so it's created a file that's over 4GB and 13.5mbps. I'll do another encode using the suggested options above, but two-pass, and do a fresh encode of what I think *should* work but doesn't. 6,000 kbps should be more than enough in theory.
__________________
PC: R9 5900X | 32GB 3600 MT/s RAM | 2*1TB NVMe | RTX 3080 | water-cooled NAS: SM 48-bay 240TB+ storage | Xeon 1220 | 32GB DDR4 ECC HTPC: Pentium J5005 | 16GB RAM | 256GB SSD | 15W |
19th November 2021, 13:23 | #10 | Link |
Video Fanatic
Join Date: Jul 2021
Location: Surrey
Posts: 89
|
When you say 30s threshold, is that forum rules? I'm trying to find an exact scene and do proper control encodes (two- or three-pass, 6000kbps) and as it's motion-dependant, it'll need more than 5s to demonstrate it.
__________________
PC: R9 5900X | 32GB 3600 MT/s RAM | 2*1TB NVMe | RTX 3080 | water-cooled NAS: SM 48-bay 240TB+ storage | Xeon 1220 | 32GB DDR4 ECC HTPC: Pentium J5005 | 16GB RAM | 256GB SSD | 15W |
19th November 2021, 14:24 | #11 | Link |
Video Fanatic
Join Date: Jul 2021
Location: Surrey
Posts: 89
|
OK, I have cut a segment from the source file (just under 15s long) and encoded it thrice.
Where to find the issue A fair example (not a perfect example) of the problem can be seen with the woman's head movement at ~11s in to the clip for approximately 2500ms. Please note the background being 'merged' into her head movement. It's partially there in this x264 encode as well, but this is only there for a comparison to show that, in my eyes looking one frame at a time and comparing, the x264 encode at the same bitrate as the x265 produces a better result. I have completed about a dozen test encodes of full episodes and find x265 to be far better in general, but it's just this bloody grain issue that's stopping me from proceeding with x265 (my general tests have shown a 35% reduction in file size with x265 compared to x264, apart from this grain issue). Files provided I've provided four files - all the same 14s 919ms long:
Opinion Looking frame-by-frame, I believe the best result is (just about) produced with Boulder's suggestion parameters. What do you think? Technical Specifications
The Files - these will be deleted at some point Source: _Supernatural_source_VC1.mkv x265 custom: _Supernatural_encode_3pass_custom_x265.mkv x265 Waggoner: _Supernatural_encode_3pass_Waggoner_x265.mkv x265 Boulder: _Supernatural_encode_3pass_Boulder_x265.mkv.mkv x264 custom: _Supernatural_encode_3pass_custom_x264.mkv Disclaimer: I own the original Blu-ray discs and do not condone piracy. I offer these 15 second clips for evaluation in order to help me legally back-up purchased content for my viewing. If I have unknowingly broken any forum rules, I apologise and ask that this post is deleted.
__________________
PC: R9 5900X | 32GB 3600 MT/s RAM | 2*1TB NVMe | RTX 3080 | water-cooled NAS: SM 48-bay 240TB+ storage | Xeon 1220 | 32GB DDR4 ECC HTPC: Pentium J5005 | 16GB RAM | 256GB SSD | 15W Last edited by tonemapped; 19th November 2021 at 14:41. Reason: Added a link to Boulder's suggestion encode |
19th November 2021, 14:36 | #12 | Link |
Video Fanatic
Join Date: Jul 2021
Location: Surrey
Posts: 89
|
Added your suggestions to the list of encodes in the post above. Thank you to you and Ben.
__________________
PC: R9 5900X | 32GB 3600 MT/s RAM | 2*1TB NVMe | RTX 3080 | water-cooled NAS: SM 48-bay 240TB+ storage | Xeon 1220 | 32GB DDR4 ECC HTPC: Pentium J5005 | 16GB RAM | 256GB SSD | 15W |
19th November 2021, 18:59 | #13 | Link |
Pig on the wing
Join Date: Mar 2002
Location: Finland
Posts: 5,812
|
6000 kbps is actually not much for a grainy 1080p source so x265 will definitely start eating the grain. It might do for a 720p encode, depending on the aspect ratio.
You could also try using Avisynth and some filtering. SPresso at some very light settings can be undistinguishable but reduces the required bitrate by 5-15%.
__________________
And if the band you're in starts playing different tunes I'll see you on the dark side of the Moon... |
19th November 2021, 21:38 | #14 | Link | |
Video Fanatic
Join Date: Jul 2021
Location: Surrey
Posts: 89
|
Quote:
__________________
PC: R9 5900X | 32GB 3600 MT/s RAM | 2*1TB NVMe | RTX 3080 | water-cooled NAS: SM 48-bay 240TB+ storage | Xeon 1220 | 32GB DDR4 ECC HTPC: Pentium J5005 | 16GB RAM | 256GB SSD | 15W |
|
20th November 2021, 08:46 | #15 | Link |
Registered User
Join Date: Dec 2013
Location: Berlin, Germany
Posts: 408
|
Well for grain and such a good rate for HD is around 3.5-4 Mbit with HEVC. I dont know where you guys take that "6Mbit, use x264" from.
Now we do not have the actual source. The "Source" provided here has around ~13Mbit video which is already compressed hard and in an inferior codec. My guess is that most bits are spent on compression artifacts. The Grain is stuck to the hair in this "Source" already, an encoder cannot magically unstuck it. |
20th November 2021, 12:33 | #16 | Link |
Pig on the wing
Join Date: Mar 2002
Location: Finland
Posts: 5,812
|
At lower bitrates, you are better off with aq-mode 2 and SAO (maybe selective SAO could be used). Yes, SAO does eat grain for breakfast but you can't have both detail and a low bitrate if the source is not easy to compress. HEVC blurs while AVC creates blocking when the bitrate is not enough to keep the details. Blocking may look better in motion, depending on your viewing distance etc.
A lot of people think that HEVC is better because it is newer, but in fact the use cases are more or less related to being able to create a watchable video at a low bitrate at higher resolutions, at least for x265. You can easily see how most of the actual development is done on that part, and that is why I've always taken the developers' fancy new things with a grain of salt. I myself use x265 because of HW support for 10bit encodes and of course HDR encodes pretty much require using it.
__________________
And if the band you're in starts playing different tunes I'll see you on the dark side of the Moon... |
27th November 2021, 08:32 | #17 | Link | |
Video Fanatic
Join Date: Jul 2021
Location: Surrey
Posts: 89
|
Quote:
Please zoom in and you'll see the problem is far more pronounced in the encodes.
__________________
PC: R9 5900X | 32GB 3600 MT/s RAM | 2*1TB NVMe | RTX 3080 | water-cooled NAS: SM 48-bay 240TB+ storage | Xeon 1220 | 32GB DDR4 ECC HTPC: Pentium J5005 | 16GB RAM | 256GB SSD | 15W |
|
27th November 2021, 11:51 | #18 | Link | |
Registered User
Join Date: Dec 2013
Location: Berlin, Germany
Posts: 408
|
Looks like I have to be happy your "source" is not in H.262. What I meant is that you did not provide the snippet from the mezzanine the Blu-Ray was made from. Sorry but your source is Not So Good.
Quote:
I tried encoding your VC-1 snippet and got this at 4Mbit video with a differenct encoder: https://drive.google.com/file/d/1HrT...ew?usp=sharing While the hard blocks from VC-1 got smoothed out due to rate I see no additional problems introduced around the hair ? |
|
27th November 2021, 15:30 | #19 | Link | |||
Video Fanatic
Join Date: Jul 2021
Location: Surrey
Posts: 89
|
Quote:
Quote:
Quote:
__________________
PC: R9 5900X | 32GB 3600 MT/s RAM | 2*1TB NVMe | RTX 3080 | water-cooled NAS: SM 48-bay 240TB+ storage | Xeon 1220 | 32GB DDR4 ECC HTPC: Pentium J5005 | 16GB RAM | 256GB SSD | 15W |
|||
27th November 2021, 18:42 | #20 | Link |
Registered User
Join Date: Dec 2013
Location: Berlin, Germany
Posts: 408
|
You know, Blu-Rays are copy protected and are not meant to be used as a source for encoding the content further. So I guess keep your disc ?
You also seem to have a basic misunerstanding of data processing. Please read this Wikipedia article: Garbage in, garbage out As I wrote previously: 'My guess is that most bits are spent on compression artifacts. The Grain is stuck to the hair in this "Source" already, an encoder cannot magically unstuck it.' Now x265 is not among the best HEVC encoders that are available but it is not really bad either - I mean at least its free. I think using crappy sources like yours prevent proper detail retention with x265 further. The quality issue you try to solve is really negligible if one takes the state of the source material into account and what an encoder can still do given such input. I only posted the output of a different encoder to prove that it can be done in higher 'quality' compared to x265. Proving that something can be done better is very important in compression for some people. It differentiates between realistic and unrealistic demands in the ever present request for higher compression efficiency. |
Tags |
grain, x265 |
Thread Tools | Search this Thread |
Display Modes | |
|
|