View Full Version : Preserving grain
futurex
17th June 2006, 03:11
Hello,
I am using megui to encode mpeg2 to x264, but noticed a considerable quality loss due to deblocking which i put on -3,-2. i know i can disable deblocking but that ofcourse will introduce artefacts. the problem is that in removing grain it removes detail as well, like
original:
http://img156.imageshack.us/img156/8849/withgrain0ik.jpg
x264:
http://img156.imageshack.us/img156/1687/withoutgrain7zl.jpg
is there any way to preserve grain? this happens even with good bitrates, 1300kb/s at 704x400. i use sharktooth HQ slowest profile except i changed the deblocking to -3, -2. i searched and saw mentioned sharktooths matrix but it didnt help. i am new to megui so please be gentle if there is a setting for this!
CruNcher
17th June 2006, 04:20
@futurex that is normal without FGS support you won't be able to preserve this kind of Details @ those Low Bitrates and to turn of deblocking the bitrate in your case is to low too, so you have to life with blocks in high motion sequences or you prefer the detail lose thats up to you another possibility would be to use a higher bitrate.
Sharktooth
17th June 2006, 04:36
if you can "live" with bitrates around 1600kbps and higher you can try my EQM AVC-HR custom matrix, it should help preserving grain and reducing blocking.
futurex
17th June 2006, 05:44
thanks cruncher and sharktooth, i'll encode a short clip at 1600kbps and see what it looks like :-)
Manao
17th June 2006, 09:49
futurex : why would you try to preseve the "grain" of a so bad looking source ? Seing how overshapped it is, what you see isn't grain, it's plain noise enhanced by the sharpening. If you want noise at playback, just add it with ffdshow. ( Imho, even if you don't want noise, you should add it, because it will enhance the visual impression )
*.mp4 guy
17th June 2006, 10:11
Manao If you noticied the (very bad) haloing I find it hard to beleive that you wouldn't have noticed the (quite evident) bluring present in the screenshot of x264. It definately doesn't look like noise is all the inloop filter is removing to me, or is mpeg4 avc's inloop filter the first perfect denoiser that never removes details by accident ;) .
futurex
17th June 2006, 10:46
manao: it's not that bad looking and the grain is not as obvious, it's just been zoomed in and then resized for greater visibility :-)
its a digital tv mpeg2 i captured, i'm sure the haloing is also present on the dvd when it gets released ;-)
im suprised you didnt notice x264's inloop filter is removing not only grain, but grain from his face, looks like he shaved!
i did an encode at 1800kbps, sharktooths matrix, no deblocking and it did preserve the noise for the most part, but i think it'll have to go 2200+ to be comparable to the mpeg2, but really 1200kbps was my limit until i get a bigger hard disk :-(
*.mp4 guy
17th June 2006, 11:59
i did an encode at 1800kbps, sharktooths matrix, no deblocking and it did preserve the noise for the most part, but i think it'll have to go 2200+ to be comparable to the mpeg2, but really 1200kbps was my limit until i get a bigger hard disk :-(
Is there too much blocking? Or is it that detail still isn't being preserved well enough?
futurex
17th June 2006, 12:08
bit of both, but mostly because of detail. then again i'm kind of picky, maybe time to get a new hdd, they're pretty cheap. this doesnt happen with non-grainy sources and i can do about 1300to 1400kbps encodes which are quite close to the source
Manao
17th June 2006, 12:42
Futurex : what is the quantizer of the frame you took the screenshot from ?
I find it hard to beleive that you wouldn't have noticed the (quite evident) bluring present in the screenshot of x264There's some bluring, I won't deny it. But nothing prevents you from also sharpening a bit during playback. And you can safely sharpen, for there are no artifact to enhance ( no noise nor blocks nor ringing )
Here's what it would look like with a proper noise added back :
http://manao4.free.fr/grained.png
As you can see, Lock can recover his weathered tan quite easily with a bit of noise added.
futurex
17th June 2006, 13:32
thanks manao, but i assume this would be done in an avisynth script (pp during playback may be troublesome for the pc) which then gets encoded to x264 so won't it end up with the same blurring effect/detail loss?
the problem is, it's the actual texture that is wiped out/blurred, which i fear cannot be recovered through any avisynth script :-(
Manao
17th June 2006, 13:40
Here is the grain lost during the encoding :
http://manao4.free.fr/grain.png
And here's the grain I generated ( Addgrain, zoomed ) :
http://manao4.free.fr/regrain.png
As you can see, there's not that much of a texture in the first screenshot, and none in the second.
Didée
17th June 2006, 14:58
By chance, I've 2 pics of Locke on my USB-stick where I showed something to one of my collegues at work.
First: Screenshot from original mpeg2 source of "Premiere" (Pay-TV). Original is anamorph. This *should* be *supposed* to be the better source of them two.
http://img206.imageshack.us/img206/9769/lockepremiereanamorph9jj.th.png (http://img206.imageshack.us/my.php?image=lockepremiereanamorph9jj.png)
Streamed from "Pro7" (Free-TV). Original is "only" 16:9 letterboxed, with a big "7" logo. This should be supposed to be the worse of them two sources.
Screenshot is from encoding to "outdated technology" (XviD) @ 1400 kbps, after some slight filtering. :p
http://img206.imageshack.us/img206/7390/lockepro7letterboxed2anamorph9.th.png (http://img206.imageshack.us/my.php?image=lockepro7letterboxed2anamorph9.png)
Zooming you may do on your own.
(The "strange" AR is because of playback thru TV-out /w overscan compensation ... it's okay like that.)
*.mp4 guy
17th June 2006, 15:06
This is a screenshot of the amplified difference between the source and a divx encoded version of a scene from the matrix revolutions (a virtually noisless source)
http://img228.imageshack.us/img228/1474/examplenoise3fe.png
Notice how it looks like all that was lost in areas that contained texture was noise, but anyone who has viewed a Q4 divx file can tell that more then "noise" is removed from the picture.
Didée
18th June 2006, 11:53
The point I was trying to make is NOT: my XviD encodes look better than all you guys x.264 encodes ...
The point I was trying to make is this:
Encoding to a lossy encoder will lose information. Always. No way around that. Therefore, it's a valid strategy to slightly bump up those kinds of information we want to keep (detail), and reduce those kinds of information we don't want to keep (noise et al.) before feeding the source into the encoder. This greatly helps the encoder to produce an output more close to what we would like to have.
In particular this holds up for DVB broadcasts, at least for the ones I'm used to get from satellite: grain is distorted by the realtime recompression, detail is damped down and softened, additional artefacts have been introduced that shouldn't be there in the first place, and so on. (DVB in Germany is faaar away from DVD quality ... more close to that of a n00b's first DVD Rip, instead.)
For comparison ... in the thread Very good quality at 10000+ kbps (http://forum.doom9.org/showthread.php?t=112378) the OP asks by what codec to achieve maximum results at 10k bitrates. However, he is also speaking about a "standard PAL broadcast". Now, it seems like he'll only come very close to the point where the broadcast originally was. Never beyond, and in fact still below. However I suspect that, when fondling the source with a little Avisynth, the final experience would be better than that of the original broadcast, instead of "just as good". At 5k bitrate instead of 10k, probably.
Sorry for the small excurse. But video encoding is a complex topic ... and if one is using only half of those puzzle pieces that were in the box, the puzzle will keep being holey.
P.S. In case anyone is wondering ... what I used for the LOST people, after cleaning-up & generalization has become known as "SeeSaw()".
Soulhunter
18th June 2006, 18:31
Related discussion... (http://forum.doom9.org/showthread.php?t=112493) ^^
Bye
Pookie
19th June 2006, 07:22
Here's a short (<10 sec) vid only source you can experiment on:
8.5mb
http://rapidshare.de/files/23464355/jl.zip.html
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.