Log in

View Full Version : Need advice on partially interlaced film


pereant
8th June 2011, 23:31
Hello,

I've already started a discussion here (http://forum.doom9.org/showthread.php?p=1506509#post1506509) and i am following now the advice by Groucho2004 (http://forum.doom9.org/showthread.php?p=1506525#post1506525) to post a short sample (ca.16MB) of what i call critical: http://www64.zippyshare.com/v/42433169/file.html

I'm having issues finding the right de-interlacing method since a few parts of the film won't get de-interlaced properly. A good example is at 00:08 (the guy in white t-shirt on the right).

I also would be happy to get advices on how to optimize the image (denoising etc.) for good compressibility since i focus on a x264 encode in the end.

Thanks in advance and sorry for my ignorance. I think this one is a good example to learn.

Didée
9th June 2011, 00:20
There is nothing special about the interlaced structure, no special deinterlacing strategy is needed. It is a standard 60i NTSC video (60 distinct fields per second), and any deinterlacer should deal with it.
The strange thing is the color resolution. There is noticeable color gloom going on, and the red colors exhibit those funny vertical stripes, in particular in the area of "white" surfaces. Could it be the video was shot with a 4:1:1 DV camera system? (I know them from hearsay, but haven't seen much of them yet.)

Deinterlacing is not the problem here, but the color is.

I feel something like

[bob/deinterlace]
turnleft.separatefields
mergechroma(vinverse).weave.blur(0,1).turnright
mergechroma(awarpsharp2)

but no time to work it out now. I'm already sleeping, g'nite. :)

pereant
9th June 2011, 13:14
Appreciated.
I can't tell you anything about the shooting, sorry.
I'll take your advice and try to get familiar with that code. Avisynth usage is completely new to me as i am one of those one-clickers. Good start to learn.

pereant
9th June 2011, 13:36
I might add that "partially interlaced" has been determined by megui's auto-detection.

Didée
9th June 2011, 20:41
Compare: simple deinterlacing with e.g. Yadif (left) -vs- pre-processing + TGMC (right):

http://img855.imageshack.us/img855/2854/badchromayadif.th.png (http://img855.imageshack.us/i/badchromayadif.png/) http://img845.imageshack.us/img845/5480/badchromapreproctgmc.th.png (http://img845.imageshack.us/i/badchromapreproctgmc.png/)

Video samples: <klick> (http://www.mediafire.com/?4pqpuqze5kdd89d)

Is this acceptable?

pereant
9th June 2011, 21:35
pre-processing + TGMC (right):

Is this acceptable?

Hell yeah! I have just compared this second frame with a bunch of trial & error rips i've done. Yours looks much better!
Could you post the avs script and anything i should know, please?
Thanks a bunch, didée!

Oh i see that's yours http://avisynth.org/mediawiki/TempGaussMC :lol:

Didée
9th June 2011, 22:03
Yes. Though one could/should use QTGMC instead. I'm just being nostalgic.

Basically it's not about the deinterlacer. The color problems are processed separately. Q/TGMC is "only" there to give a stable deinterlacing and good compressibility. :)

# setmtmode(5,4) # only if you're using an Avisynth-MT build

SetMemoryMax(256)

LoadPlugin("DGDecode.dll")
LoadPlugin("RemoveGrainSSE2.dll")
LoadPlugin("RepairSSE2.dll")
LoadPlugin("mt_masktools-25.dll")
LoadPlugin("MVTools2.dll")
LoadPlugin("NNEDI3.dll")
LoadPlugin("VerticalCleanerSSE2.dll")
LoadPlugin("AddGrainC.dll")
LoadPlugin("awarpsharp2.dll")

Import("TGMC_b2.avsi") # should be QTGMC, of course


mpeg2source("Original.d2v")

# setmtmode(2) # see 1st line above
o = last

x = o.separatefields.deblock(30)
x0 = x.gsharp()
x = x.mergeluma(x.removegrain(20).removegrain(20),0.0999).mt_lutxy(x,"x y < x 1 + x y > x 1 - x ? ?",U=2,V=2)
x = x.mergechroma(x.blur(1))

x1 = x.mergechroma(x.lanczosresize(x.width,x.height*2).awarpsharp2(depth=6,thresh=128,blur=2).lanczosresize(x.width,x.height))
x2 = x.mergechroma(x.lanczosresize(x.width,x.height*2).awarpsharp2(depth=12,thresh=192,blur=2).lanczosresize(x.width,x.height))
x = mt_merge(x,x1,x2,Y=2,U=4,V=5).weave() # no mask-merging, just joining 3 channels ;-)

x.tempgaussmc_beta2(1,1,2,edimode="nnedi3",sharp=1) .gnoise(2,0.6).gnoise(1,1.25)

return(last)

#-----------------------------------------
function gsharp(clip c, float "str") {
str = default(str, 1.51)
mt_lutxy(c,c.removegrain(11),"x x y - abs 1 1.6 / ^ "+string(str)+" * x y - x y - abs 0.001 + / * +",U=3,V=3) }

function gnoise(clip c, int str, float ss) {
grr=blankclip(c,width=round((c.width*ss)/4.)*4,height=round((c.height*ss)/4.)*4).mt_lut("x",Y=-128).addgrainc(str,0)
c.mt_adddiff(grr.bicubicresize(c.width,c.height,-.2,.6),U=2,V=2) }

Most plugins should be linked in the QTGMC thread. Finding awarpsharp2 is the exercise left over. :p

Don't ask me how to get this into MeGUI. Never have used it.

pereant
9th June 2011, 22:19
Since i'm still running a dual core system i'll stick with TGMC as i have been warned to use QTGMC in terms of slowness.

Thank you very much, didée. You were truly a helping hand.

In diesem Sinne "Sprecken sie deutch?"

;)

Groucho2004
9th June 2011, 22:36
Since i'm still running a dual core system i'll stick with TGMC as i have been warned to use QTGMC in terms of slowness.
They are both slow. QTGMC is basically a more user friendly version with presets (slow, fast, etc) and some additional features. You should use QTGMC.

-Vit-
9th June 2011, 23:07
Try :
x.QTGMC( "Faster", TR0=1,TR1=1,TR2=2, SubPelInterp=1 ).gnoise(2,0.6).gnoise(1,1.25)
to replace the tempgaussmc_beta2 line in Didée's script. Or a different preset ("Medium", "Fast", "Faster", "Very Fast", "Super Fast", etc)

pereant
11th June 2011, 12:29
To google a download source for awarpsharp2 is truly a challenge :p
But thankfully i found out it‘s all here.
Try :
x.QTGMC( "Faster", TR0=1,TR1=1,TR2=2, SubPelInterp=1 ).gnoise(2,0.6).gnoise(1,1.25)
to replace the tempgaussmc_beta2 line in Didée's script. Or a different preset ("Medium", "Fast", "Faster", "Very Fast", "Super Fast", etc)
Thanks, vit. That rubbed my last question mark out. :)
At the moment the first pass is running (complete film 1h9m): 12 hours elapsed, 6 hours remaining - looking forward to the second pass x-D

Thanks so much to all of you and esp. didée

cretindesalpes
11th June 2011, 12:38
If you do a two-pass encoding with a slow script, you should first render the script result to a lossless file (or even multiple files), and use this file for your encoding. Because:
1. the script will be executed only once, meaning significant time gain, and
2. it minimizes the risks of crashing

Groucho2004
11th June 2011, 12:47
At the moment the first pass is running (complete film 1h9m): 12 hours elapsed, 6 hours remaining

Ouch.

pereant
11th June 2011, 12:52
I heed your advice for my next encode. In terms of lossless; what would you recommend except uncompressed avi? I‘m scared of its resulting file size.

cretindesalpes
11th June 2011, 12:57
x264 --qp 0 --keyint 4 --preset ultrafast
should work fine.

pereant
11th June 2011, 12:59
Doh ... Thanks!

Tempter57
31st August 2011, 08:48
Yes. Though one could/should use QTGMC instead. I'm just being nostalgic.

Basically it's not about the deinterlacer. The color problems are processed separately. Q/TGMC is "only" there to give a stable deinterlacing and good compressibility. :)

# setmtmode(5,4) # only if you're using an Avisynth-MT build

SetMemoryMax(256)

LoadPlugin("DGDecode.dll")
LoadPlugin("RemoveGrainSSE2.dll")
LoadPlugin("RepairSSE2.dll")
LoadPlugin("mt_masktools-25.dll")
LoadPlugin("MVTools2.dll")
LoadPlugin("NNEDI3.dll")
LoadPlugin("VerticalCleanerSSE2.dll")
LoadPlugin("AddGrainC.dll")
LoadPlugin("awarpsharp2.dll")

Import("TGMC_b2.avsi") # should be QTGMC, of course


mpeg2source("Original.d2v")

# setmtmode(2) # see 1st line above
o = last

x = o.separatefields.deblock(30)
x0 = x.gsharp()
x = x.mergeluma(x.removegrain(20).removegrain(20),0.0999).mt_lutxy(x,"x y < x 1 + x y > x 1 - x ? ?",U=2,V=2)
x = x.mergechroma(x.blur(1))

x1 = x.mergechroma(x.lanczosresize(x.width,x.height*2).awarpsharp2(depth=6,thresh=128,blur=2).lanczosresize(x.width,x.height))
x2 = x.mergechroma(x.lanczosresize(x.width,x.height*2).awarpsharp2(depth=12,thresh=192,blur=2).lanczosresize(x.width,x.height))
x = mt_merge(x,x1,x2,Y=2,U=4,V=5).weave() # no mask-merging, just joining 3 channels ;-)

x.tempgaussmc_beta2(1,1,2,edimode="nnedi3",sharp=1) .gnoise(2,0.6).gnoise(1,1.25)

return(last)

#-----------------------------------------
function gsharp(clip c, float "str") {
str = default(str, 1.51)
mt_lutxy(c,c.removegrain(11),"x x y - abs 1 1.6 / ^ "+string(str)+" * x y - x y - abs 0.001 + / * +",U=3,V=3) }

function gnoise(clip c, int str, float ss) {
grr=blankclip(c,width=round((c.width*ss)/4.)*4,height=round((c.height*ss)/4.)*4).mt_lut("x",Y=-128).addgrainc(str,0)
c.mt_adddiff(grr.bicubicresize(c.width,c.height,-.2,.6),U=2,V=2) }

Most plugins should be linked in the QTGMC thread. Finding awarpsharp2 is the exercise left over. :p

Don't ask me how to get this into MeGUI. Never have used it.

Where x0 = x.gsharp() used in this script?

Didée
31st August 2011, 09:03
Oops.

x = mt_merge(x0,x1,x2,Y=2,U=4,V=5).weave() # no mask-merging, just joining 3 channels ;-)

Tempter57
31st August 2011, 09:05
Didée

Thank you