View Full Version : Film Grain Modelling for x264?
LiFe
18th December 2006, 04:01
Heya Folk,
I've previously had brilliant success on all my sources with crf 22 and Nero 5.1 AAC.
I've now got some very grainy DVD material to encode. Obviously it's a film based source, then they've over compressed it to get it on DVD and the film grain is pretty severe in the background.
Is there any progress on supporting film gain modeling in x264? If it fixed these sources, I think I'd be prepared to pay for this!
I've tried a few noise removing filters, but anyone got any magic ideas of how to encode this so that there arn't fat spots jumping around, or the background jumping in and out?
Thanks.
Sharktooth
18th December 2006, 04:14
FGM for x264? uhm i doubt aku will put any effort into it...
however if you post a sample we can examine it...
akupenguin
18th December 2006, 05:26
Note: film grain modelling isn't a magic bullet. If you can successfully remove the grain, then FGM would allow you to store it more efficiently and automatically re-add it on playback. But if you're having trouble denoising the source in the first place, FGM won't help.
Sounds like what you're really asking for is a magic denoising filter, which doesn't have anything to do with H.264
R3Z
18th December 2006, 05:54
You obviously arent after a noise addition feature so why not experiment using the in loop deblocking filter ?
x264 smooths out everything ridiculously anyway so you have me stumped. Why not post a sample ?
LiFe
19th December 2006, 11:37
OK, thanks for the feedback.
Sample:
http://www.users.on.net/~lifers/SC/Section-2.vob
I've found MeGUI less than stellar on my PAL encodes with interlacing, I get lots of jaggies on diagonal straight edges, and it seems I get 'hints' of interlacing.
Besides that, the source is pretty noisy and I havn't been able to fix it without making it all soft.
Thanks.
check
19th December 2006, 11:42
MeGUI has nothing more to do with your encoding beyond being a frontend (http://mewiki.project357.com/wiki/Glossary#Frontend)for various other tools.
Morte66
19th December 2006, 12:16
OK, thanks for the feedback.
Sample:
http://www.users.on.net/~lifers/SC/Section-2.vob
I've found MeGUI less than stellar on my PAL encodes with interlacing, I get lots of jaggies on diagonal straight edges, and it seems I get 'hints' of interlacing.
Back when I used MeGUI for everything, it always seemed a little shaky at choosing a deinterlacer for interlaced PAL DVD, especially if started life as NTSC video, and more so if there's any progressive mixed in. This covers the PAL DVDs of many older US TV shows. Whenever the interlacing analysis says something about "trys to weave it before etc etc", watch out. When I do this sort of material, I preview the script MeGUI writes and if I'm not happy I change the deinterlacing to just "TDeint()". That generally improves things.
But you will still get occasional glitches and jaggies from imperfect 480 to 576 line conversion, that's on the PAL DVD and there's not much you can do (apart from buying used NTSC DVDs from Amazon).
Morte66
19th December 2006, 12:39
OK, thanks for the feedback.
Besides that, the source is pretty noisy and I havn't been able to fix it without making it all soft.
There's a slow fractal denoiser for AviSynth called FrFun7() that seems to scrape crud off DVDs extremely well without softening things too much. Search the Doom9 forums, there's a thread about it. Try and see if it suits you.
For me, it usually hits a fundamental problem of really bad DVDs: you get rid of the noise and find that it was the only thing hiding the blocking, which is now obvious and so horrible that you want the noise back.
[The usual suggestion at Doom9 is to denoise before/within the encode and add noise on playback to hide the blocks. But whenever I try this, e.g. using the DeBand filter for ffdshow, it looks pretty poor -- the block-hiding noise desaturates the colour and/or gets confused by motion. The best results I've had on this sort of material are using high rate Xvid, which (pretty much) encodes the original noise (but doesn't save you much space). So I would be interested to see what grain retention for x264 could do.]
R3Z
20th December 2006, 05:11
Wooo fellow node users ! :)
I had a quick go at getting it to look decent, you and others may or may not agree but i think it looks substantially better considering how grainy/noisy it is.
Heres the original;
http://www.users.on.net/~inet_s51/LIFe/original.jpg
Heres the sharpened and denoised;
http://www.users.on.net/~inet_s51/LIFe/test4.jpg
Heres the sample clip converted to x264 (came in at 5.8mb down from 25mb);
http://www.users.on.net/~inet_s51/LIFe/test4.mp4
Heres the script i used (i am aware that the experts here will probably say its shit and wrong - but i did try to help ;) ) ;
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\fft3dfilter.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\DeGrainMedian.dll")
DGDecode_mpeg2source("Section-2.d2v")
edeintted = last.AssumeTFF().SeparateFields().SelectEven().EEDI2(field=-1)
TDeint(order=1,full=false,edeint=edeintted)
DeGrainMedian(limitY=4,limitUV=3,mode=1)
DeGrainMedian(limitY=4,limitUV=3,mode=1)
FFT3DFilter(sigma=3, sharpen=0.5)
LimitedSharpen(ss_x=1.0,ss_y=1.0,Smode=3,strength=50)
Heres the megui x264 profile i used;
--crf 22 --keyint 250 --ref 6 --mixed-refs --no-fast-pskip --bframes 3 --b-pyramid --b-rdo --bime --weightb --direct auto --filter -2,-2 --subme 6 --trellis 1 --analyse all --8x8dct --vbv-maxrate 25000 --me umh --threads 2 --thread-input --cqmfile "C:\Documents and Settings\Administrator.PC01\Desktop\EQM_HR.cfg" --progress --no-dct-decimate --no-psnr --no-ssim --output "" ""
Any suggestions by experts very welcome ! ;)
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.