Log in

View Full Version : Help making some DVDs more compressible?


trevaaar
11th December 2011, 08:44
I'm in the middle of adding a few recently purchased DVDs to the media library and I'm having trouble getting a good looking result encoding the first few seasons of Doc Martin without hitting the same file size as the source VOBs. Normally I'd just throw MCTemporalDenoise at them and all would be well in the world but it's not helping as much as I'd hope.

The source is PAL DVD and I'm encoding with x264 (using a CRF of 18). I've uploaded a short sample from the first episode here (http://www.mediafire.com/?skb3u55kux3wcwy). So basically any advice you experts have to clean up the video a bit would be much appreciated.

Didée
12th December 2011, 19:55
Ah, a typical DVD misery.

If MCTemporalDenoise "didn't help much", then it propably wasn't tweaked to fit this particular source. There's lots of parameters in MCTD, you know. (But I can't advise any, since I never use MCTD....)

With simple/fast filters, I fear the result will be not very "nice". If at all, perhaps some moderate spatial easening of the grain (maybe Spresso() ), uppen the CRF for x264, and let it be good. This will, at least, be fast.

* * * *

Looking at the sample, I felt that this multilevel approach (forum.doom9.org/showthread.php?p=1512413#post1512413) should fit the case. Setting up the chain all-new from scratch, the result was

CRF=18 with given script (http://www.mediafire.com/?if6tlyv8fmvbvf9)

vs.

CRF=18 without any filters (http://www.mediafire.com/?nhe79h6o64grha4)


There's no fancy re-sharpening or anything, just plain denoising. Also, a small amount of original noise intentionally was left in, in order to not produce wax faces. Compression gain is ~35%, it could be more, obviously, when not keeping some of the original noise, but then it would also look less natural.

May be the script is too slow to process seasons of episodes with it .... I didn't care for the speed. It was lunchbreak, I had half an hour for toying, this is what stood there when the bell rang. :)

# MVTools2.dll
# removegrainSSE2.dll
# mt_masktools.dll
# FluxSmooth.dll

mpeg2source("DocMartin-101-sample.d2v")

o=last ox=o.width() oy=o.height()

half = o.bicubicresize(512,416)
half_up = half.bicubicresize(ox,oy)
sup00 = half.removegrain(11).msuper(pel=2,sharp=1)
sup01 = half.msuper(pel=2,sharp=1,levels=1)

bv02=sup00.manalyse(isb=true, delta=2,truemotion=false,global=true,blksize=16,overlap=8,search=5,searchparam=2,DCT=5)
bv01=sup00.manalyse(isb=true, delta=1,truemotion=false,global=true,blksize=16,overlap=8,search=5,searchparam=2,DCT=5)
fv01=sup00.manalyse(isb=false,delta=1,truemotion=false,global=true,blksize=16,overlap=8,search=5,searchparam=2,DCT=5)
fv02=sup00.manalyse(isb=false,delta=2,truemotion=false,global=true,blksize=16,overlap=8,search=5,searchparam=2,DCT=5)

NR00 = half.mdegrain2(sup01,bv01,fv01,bv02,fv02)
NR01 = NR00.bicubicresize(ox,oy).mt_adddiff(mt_makediff(o,half_up,U=1,V=1),U=2,V=2)
NR01a = mt_lutxy(NR01,o,"x 2 + y < x 2 + x 2 - y > x 2 - y ? ?",U=2,V=2)

sup10 = NR01.fluxsmootht(5).removegrain(11).msuper(pel=2,sharp=1)
sup11 = NR01a.msuper(pel=2,sharp=1,levels=1)

bv13=sup10.manalyse(isb=true, delta=3,truemotion=false,global=true,blksize=16,overlap=8,search=5,searchparam=6,DCT=5)
bv12=sup10.manalyse(isb=true, delta=2,truemotion=false,global=true,blksize=16,overlap=8,search=5,searchparam=6,DCT=5)
bv11=sup10.manalyse(isb=true, delta=1,truemotion=false,global=true,blksize=16,overlap=8,search=5,searchparam=6,DCT=5)
fv11=sup10.manalyse(isb=false,delta=1,truemotion=false,global=true,blksize=16,overlap=8,search=5,searchparam=6,DCT=5)
fv12=sup10.manalyse(isb=false,delta=2,truemotion=false,global=true,blksize=16,overlap=8,search=5,searchparam=6,DCT=5)
fv13=sup10.manalyse(isb=false,delta=3,truemotion=false,global=true,blksize=16,overlap=8,search=5,searchparam=6,DCT=5)

NR01a.mdegrain3(sup11,bv11,fv11,bv12,fv12,bv13,fv13)
\ .mt_lutxy(o,"x y < x 1 + x y > x 1 - x ? ?",U=3,V=3)

#stackhorizontal(o,last)

return(last)

chainring
14th December 2011, 18:02
Since the wonderful Spresso has been mentioned, is this the latest iteration?

function SPresso(clip clp, int "limit", int "bias", int "RGmode")
{
limit = default( limit, 2 )
bias = default( bias, 25 )
RGmode = default( RGmode, 4 )

LIM1 = (limit>0) ? string( round(limit*100.0/bias-1.0) ) : string( round(100.0/bias) )
LIM2 = (limit<0) ? "1" : string(limit)
BIA = string(bias)

expr = (limit<0) ? "x y - abs "+LIM1+" < x x 1 x y - x y - abs / * - ?"
\ : "x y = x x "+LIM1+" + y < x "+LIM2+" + x "+LIM1+" - y > x "+LIM2+" - " \
+ "x 100 "+BIA+" - * y "+BIA+" * + 100 / ? ? ?"

mt_lutxy( clp, clp.removegrain(RGmode,-1), expr, U=2,V=2)
}

And would this be the latest for Spresso that works on chroma?

function SPresso(clip clp, int "limit", int "bias", int "RGmode", int "limitC", int "biasC", int "RGmodeC")
{
limit = default( limit, 2 )
limitC = default( limitC, 4 )
bias = default( bias, 25 )
biasC = default( biasC, 50 )
RGmode = default( RGmode, 4 )
RGmodeC = default( RGmodeC, 0 )

yy = (RGmode ==0) ? 2 : 3
uv = (RGmodeC==0) ? 2 : 3
LIM1 = (limit>0) ? string( round(limit*100.0/bias-1.0) ) : string( round(100.0/bias) )
LIM2 = (limit<0) ? "1" : string(limit)
BIA = string(bias)
LIM1c = (limitC>0) ? string( round(limitC*100.0/biasC-1.0) ) : string( round(100.0/biasC) )
LIM2c = (limitC<0) ? "1" : string(limitC)
BIAc = string(biasC)

expr = (limit<0) ? "x y - abs "+LIM1+" < x x 1 x y - x y - abs / * - ?"
\ : "x y - abs 0 <= x x "+LIM1+" + y < x "+LIM2+" + x "+LIM1+" - y > x "+LIM2+" - " \
+ "x 100 "+BIA+" - * y "+BIA+" * + 100 / ? ? ?"
exprC = (limit<0) ? "x y - abs "+LIM1c+" < x x 1 x y - x y - abs / * - ?"
\ : "x y - abs 0 <= x x "+LIM1c+" + y < x "+LIM2c+" + x "+LIM1c+" - y > x "+LIM2c+" - " \
+ "x 100 "+BIAc+" - * y "+BIAc+" * + 100 / ? ? ?"

# For (old) MaskTools v1.5.8 :
# yv12lutxy( clp, clp.removegrain(RGmode,RGmodeC), expr,exprC,exprC, Y=yy,U=uv,V=uv)

# For (new) MaskTools v2.x :
mt_lutxy( clp, clp.removegrain(RGmode,RGmodeC), yexpr=expr,uexpr=exprC,vexpr=exprC, Y=yy,U=uv,V=uv)

return( last )
}

I've stuck with Spresso over the years when I'm wanting just the slightest bit of cleanup and compressibility. Thanks for these!

SeeMoreDigital
14th December 2011, 19:03
I'm encoding with x264 (using a CRF of 18). I've uploaded a short sample from the first episode here (http://www.mediafire.com/?skb3u55kux3wcwy). So basically any advice you experts have to clean up the video a bit would be much appreciated.
Is there any particular reason why you don't want to generate a 2-pass encode?