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.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 8th June 2011, 23:31   #1  |  Link
pereant
Registered User
 
Join Date: Jan 2008
Posts: 20
Need advice on partially interlaced film

Hello,

I've already started a discussion here and i am following now the advice by Groucho2004 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.
pereant is offline   Reply With Quote
Old 9th June 2011, 00:20   #2  |  Link
Didée
Registered User
 
Join Date: Apr 2002
Location: Germany
Posts: 5,390
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

Code:
[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.
__________________
- We´re at the beginning of the end of mankind´s childhood -

My little flickr gallery. (Yes indeed, I do have hobbies other than digital video!)
Didée is offline   Reply With Quote
Old 9th June 2011, 13:14   #3  |  Link
pereant
Registered User
 
Join Date: Jan 2008
Posts: 20
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 is offline   Reply With Quote
Old 9th June 2011, 13:36   #4  |  Link
pereant
Registered User
 
Join Date: Jan 2008
Posts: 20
I might add that "partially interlaced" has been determined by megui's auto-detection.
pereant is offline   Reply With Quote
Old 9th June 2011, 20:41   #5  |  Link
Didée
Registered User
 
Join Date: Apr 2002
Location: Germany
Posts: 5,390
Compare: simple deinterlacing with e.g. Yadif (left) -vs- pre-processing + TGMC (right):



Video samples: <klick>

Is this acceptable?
__________________
- We´re at the beginning of the end of mankind´s childhood -

My little flickr gallery. (Yes indeed, I do have hobbies other than digital video!)
Didée is offline   Reply With Quote
Old 9th June 2011, 21:35   #6  |  Link
pereant
Registered User
 
Join Date: Jan 2008
Posts: 20
Quote:
Originally Posted by Didée View Post
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:

Last edited by pereant; 9th June 2011 at 21:48.
pereant is offline   Reply With Quote
Old 9th June 2011, 22:03   #7  |  Link
Didée
Registered User
 
Join Date: Apr 2002
Location: Germany
Posts: 5,390
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.

Code:
# 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.

Don't ask me how to get this into MeGUI. Never have used it.
__________________
- We´re at the beginning of the end of mankind´s childhood -

My little flickr gallery. (Yes indeed, I do have hobbies other than digital video!)
Didée is offline   Reply With Quote
Old 9th June 2011, 22:19   #8  |  Link
pereant
Registered User
 
Join Date: Jan 2008
Posts: 20
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?"

pereant is offline   Reply With Quote
Old 9th June 2011, 22:36   #9  |  Link
Groucho2004
 
Groucho2004's Avatar
 
Join Date: Mar 2006
Location: A wretched hive of scum and villainy
Posts: 4,287
Quote:
Originally Posted by pereant View Post
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.
Groucho2004 is offline   Reply With Quote
Old 9th June 2011, 23:07   #10  |  Link
-Vit-
Registered User
 
Join Date: Jul 2010
Posts: 448
Try :
Code:
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)

Last edited by -Vit-; 9th June 2011 at 23:11.
-Vit- is offline   Reply With Quote
Old 11th June 2011, 12:29   #11  |  Link
pereant
Registered User
 
Join Date: Jan 2008
Posts: 20
To google a download source for awarpsharp2 is truly a challenge
But thankfully i found out it‘s all here.
Quote:
Originally Posted by -Vit- View Post
Try :
Code:
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
pereant is offline   Reply With Quote
Old 11th June 2011, 12:38   #12  |  Link
cretindesalpes
͡҉҉ ̵̡̢̛̗̘̙̜̝̞̟̠͇̊̋̌̍̎̏̿̿
 
cretindesalpes's Avatar
 
Join Date: Feb 2009
Location: No support in PM
Posts: 610
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
__________________
dither 1.27.2 for AviSynth | avstp 1.0.3 for AviSynth development | fmtconv r19 for Vapoursynth | trimx264opt segmented encoding
cretindesalpes is offline   Reply With Quote
Old 11th June 2011, 12:47   #13  |  Link
Groucho2004
 
Groucho2004's Avatar
 
Join Date: Mar 2006
Location: A wretched hive of scum and villainy
Posts: 4,287
Quote:
Originally Posted by pereant View Post
At the moment the first pass is running (complete film 1h9m): 12 hours elapsed, 6 hours remaining
Ouch.
Groucho2004 is offline   Reply With Quote
Old 11th June 2011, 12:52   #14  |  Link
pereant
Registered User
 
Join Date: Jan 2008
Posts: 20
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.
pereant is offline   Reply With Quote
Old 11th June 2011, 12:57   #15  |  Link
cretindesalpes
͡҉҉ ̵̡̢̛̗̘̙̜̝̞̟̠͇̊̋̌̍̎̏̿̿
 
cretindesalpes's Avatar
 
Join Date: Feb 2009
Location: No support in PM
Posts: 610
x264 --qp 0 --keyint 4 --preset ultrafast
should work fine.
__________________
dither 1.27.2 for AviSynth | avstp 1.0.3 for AviSynth development | fmtconv r19 for Vapoursynth | trimx264opt segmented encoding
cretindesalpes is offline   Reply With Quote
Old 11th June 2011, 12:59   #16  |  Link
pereant
Registered User
 
Join Date: Jan 2008
Posts: 20
Doh ... Thanks!
pereant is offline   Reply With Quote
Old 31st August 2011, 08:48   #17  |  Link
Tempter57
Registered User
 
Join Date: Jan 2011
Location: Ukraine, Donetsk
Posts: 31
Quote:
Originally Posted by Didée View Post
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.

Code:
# 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.

Don't ask me how to get this into MeGUI. Never have used it.
Where x0 = x.gsharp() used in this script?
Tempter57 is offline   Reply With Quote
Old 31st August 2011, 09:03   #18  |  Link
Didée
Registered User
 
Join Date: Apr 2002
Location: Germany
Posts: 5,390
Oops.

Code:
x  = mt_merge(x0,x1,x2,Y=2,U=4,V=5).weave()  #  no mask-merging, just joining 3 channels ;-)
__________________
- We´re at the beginning of the end of mankind´s childhood -

My little flickr gallery. (Yes indeed, I do have hobbies other than digital video!)
Didée is offline   Reply With Quote
Old 31st August 2011, 09:05   #19  |  Link
Tempter57
Registered User
 
Join Date: Jan 2011
Location: Ukraine, Donetsk
Posts: 31
Didée

Thank you
Tempter57 is offline   Reply With Quote
Reply

Tags
artefacts, denoise, grain, interlace, ntsc

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 05:05.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.