Quantcast Avisynth: Best Deinterlacer with MA Script? - digitalFAQ.com Forums [Archives]
Go Back    digitalFAQ.com Forums [Archives] > Video Production Forums > Avisynth Scripting

Reply
 
LinkBack Thread Tools
  #1  
01-01-2004, 05:14 PM
CheronAph CheronAph is offline
Free Member
 
Join Date: Feb 2003
Location: Espoo, Finland
Posts: 494
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to CheronAph
I have an interlaced dvd, what would be the best deinterlacer with MA script?
__________________
¨¨°º©©º°¨¨°º©CHERONAPH©º°¨¨°º©©º°¨¨
Reply With Quote
Someday, 12:01 PM
admin's Avatar
Site Staff / Ad Manager
 
Join Date: Dec 2002
Posts: 42
Thanks: ∞
Thanked 42 Times in 42 Posts
  #2  
01-01-2004, 05:17 PM
Dialhot Dialhot is offline
Free Member
 
Join Date: May 2003
Posts: 10,463
Thanks: 0
Thanked 0 Times in 0 Posts
Don't really know if it's the best but I always use FieldDeinterlace when I need one.
Reply With Quote
  #3  
01-01-2004, 05:22 PM
CheronAph CheronAph is offline
Free Member
 
Join Date: Feb 2003
Location: Espoo, Finland
Posts: 494
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to CheronAph
What settings do you use, it seems a little slow?
__________________
¨¨°º©©º°¨¨°º©CHERONAPH©º°¨¨°º©©º°¨¨
Reply With Quote
  #4  
01-01-2004, 05:28 PM
Dialhot Dialhot is offline
Free Member
 
Join Date: May 2003
Posts: 10,463
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by CheronAph
What settings do you use, it seems a little slow?
No setting at all, just use empty "()". And I don't care about speed but results
Reply With Quote
  #5  
01-01-2004, 05:32 PM
CheronAph CheronAph is offline
Free Member
 
Join Date: Feb 2003
Location: Espoo, Finland
Posts: 494
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to CheronAph
Ok, thanks!
__________________
¨¨°º©©º°¨¨°º©CHERONAPH©º°¨¨°º©©º°¨¨
Reply With Quote
  #6  
01-01-2004, 06:32 PM
incredible incredible is offline
Free Member
 
Join Date: May 2003
Location: Germany
Posts: 3,189
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to incredible
Also give this one a test as it seems to me u using PAL sources:

SmoothDeinterlace(tff=true, doublerate=true, blend=true).Selecteven()

95% of all DVD are encoded topfield first so this should result correct.

Or try Fielddeinterlace(full=false) , cause by doing this only the fast moving/combed parts will be detected and deinterlaced this preserves higher details on non-moving parts.
Reply With Quote
  #7  
01-01-2004, 11:22 PM
sbin sbin is offline
Free Member
 
Join Date: May 2003
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
Personally, I've never found a deinterlacing method that doesn't make the motion look blurry and unnatural to me. Blending fields...... blech.

When I deal with interlaced material, I usually either encode interlaced with MPEG-2 or simply discard one of the fields and resize with mf's SharpResize function (available at doom9.org). There is just really no good way to handle interlaced material, in my opinion.
Reply With Quote
  #8  
01-01-2004, 11:50 PM
kwag kwag is offline
Free Member
 
Join Date: Apr 2002
Location: Puerto Rico, USA
Posts: 13,537
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by sbin
simply discard one of the fields and resize
And throw away 50% of the information
Not to mention the jagged lines you will get too.
Go here and look what you loose
http://www.100fps.com

-kwag
Reply With Quote
  #9  
01-02-2004, 12:17 AM
sbin sbin is offline
Free Member
 
Join Date: May 2003
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
And throw away 50% of the information
Yes, unfortunately. The quality loss is there, but I sometimes find it less objectionable than the blurring that comes from blending fields. But I should have mentioned that I only do that when I'm working with relatively low quality material (like old vhs caps) and my target format is a low resolution like 352x240.

If it's a hi-res target, that's when I usually just encode interlaced. But then it consumes a lot more bitrate.....

It depends a lot on the material whether I'm willing to discard a field like that. As I said, I'm not convinced that there is really a good solution out there for interlaced material other than using MPEG-2.

Quote:
Go here and look what you loose
http://www.100fps.com
Yes, I've seen that site. Those techniques are OK for AVI targets, but they don't offer much that's practical in VCD/DVD-land.
Reply With Quote
  #10  
01-02-2004, 03:13 AM
Dialhot Dialhot is offline
Free Member
 
Join Date: May 2003
Posts: 10,463
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by sbin
If it's a hi-res target, that's when I usually just encode interlaced. But then it consumes a lot more bitrate.....
So you can't use any temporal filter (as they can't deal with interlaced frames) and I wonder also if the resizer aren't is the same case.

Do not mistake "encoding interlaced" and "encoding an interlaced source", that is not the same.


Quote:
Those techniques are OK for AVI targets, but they don't offer much that's practical in VCD/DVD-land.
Why not ?
Reply With Quote
  #11  
01-02-2004, 04:37 AM
incredible incredible is offline
Free Member
 
Join Date: May 2003
Location: Germany
Posts: 3,189
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to incredible
@ Sbin ...

You should at least use the interlaced matrix version of NOTCH to archive best results when encoding interlaced sources as interlaced in mpeg2!

http://www.kvcd.net/forum/viewtopic.php?t=7985

Quote:
So you can't use any temporal filter (as they can't deal with interlaced frames) and I wonder also if the resizer aren't is the same case.
Sorry thats not right, you can handle the interlaced frames very well by telling the Temp filter to do do his job by comparing every 2nd separated field, so there's a better solution better than just separating the fields, cause when doing the following this you're right and the temp radial scanner gets a comparison to the next field and not the next picture.

Heres the right way how to treat a FIELDbased stream:

Code:
AviSource("G:\Interlaced.avi")

video = SeparateFields().Bicubicresize(enter interlaced!! param. here)
evenfield = SelectEven(video).TemporalFiltering()
oddfield = SelectOdd(video).Temporalfiltering() 
Interleave(evenfield,oddfield)
Weave()
But in case of living in PAL Area you should watch out when getting a captured interlaced blockbuster movie, as blockbusters never have been shot on VIDEO there's no real interlacing just phase shifted treatment.
So even in PAL we perform a Telecide() using PAL settings do get rid of these phase shifts and restoring to the orig frames.
Reply With Quote
  #12  
01-02-2004, 04:45 AM
Dialhot Dialhot is offline
Free Member
 
Join Date: May 2003
Posts: 10,463
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by incredible
Sorry thats not right, you can handle the interlaced frames very well by telling the Temp filter to do do his job by comparing every 2nd separated field
When I told "you can't" I was thinking "without refonding all the script to adapt it to interlaced source". I bet than sbin do not either think that was a problem. At least, lot of people do not think about that.

BTW, using such method in the MA script is tricky, and you know that.
Reply With Quote
  #13  
01-02-2004, 09:40 AM
incredible incredible is offline
Free Member
 
Join Date: May 2003
Location: Germany
Posts: 3,189
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to incredible
This for others below could solve the problem,this may could be interesting as EVERY parameter within the routine will be performed on every xfield and interleaved afterwards.
(I also know the interlaced ma thread of Boulder)

So a nice way to apply MA into this interleaving process is as following:

First generating MA as an independend function based .avsi file to be safed in the AVS 2.5 plugins folder.
Code:
function MAroutine(clip c) {
c=ScriptClip(c, "nf = YDifferenceToNext()"+chr(13)+"unfilter( -(fmin(round(nf)*2, 100)), -(fmin(round(nf)*2, 100))).TemporalSoften( fmin(round(2/nf), 6), round(1/nf) , round(3/nf) , 15, 2)  ") 
return c
} 
function fmin( int f1, int f2) { 
  return ( f1<f2 ) ? f1 : f2 
} 

function fmax( float f1, int f2) { 
  return ( f1<f2 ) ? f2 : f1 
}
Also I use this way just to put a

MAroutine()

Command to any script IF needed.

Then in our interlaced case we can perform the following script:
(Here an real interlaced d2v source (YV12 4:2:0) as sample)

Code:
mpeg2source("G:\Interlaced.d2v") 
undot() 

video = SeparateFields()
 
evenfield = SelectEven(video).
\asharp(1, 4).
\Bicubicresize(enter interlaced!! param. here).
\StmedianFilter(3,3,1,1).
\MergeChroma(blur(1.5)).
\MAroutine()

oddfield = SelectOdd(video).
\asharp(1, 4).
\Bicubicresize(enter interlaced!! param. here).
\StmedianFilter(3,3,1,1).
\MergeChroma(blur(1.5)) .
\MAroutine()
 
Interleave(evenfield,oddfield) 

Weave()

Addborders(xxxxx)
Reply With Quote
  #14  
01-02-2004, 11:25 AM
CheronAph CheronAph is offline
Free Member
 
Join Date: Feb 2003
Location: Espoo, Finland
Posts: 494
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to CheronAph
What am I doing wrong? Tmpgenc gives this error, Mergeluma: images must have the same widht and heigt! the error is at line 10

Mpeg2Source("E:\Muumipeikko ja hattivatit\VIDEO_TS\vts_01.d2v")

video = SeparateFields()

evenfield = SelectEven(video).
\asharp(1, 4).
\BicubicResize(320, 510, 0, 0.6, 0, 1, 720, 574).
\StmedianFilter(3,3,1,1).
\MergeChroma(blur(1.5)).
\MAroutine()

oddfield = SelectOdd(video).
\asharp(1, 4).
\BicubicResize(320, 510, 0, 0.6, 0, 1, 720, 574).
\StmedianFilter(3,3,1,1).
\MergeChroma(blur(1.5)) .
\MAroutine()

Interleave(evenfield,oddfield)

Weave()

AddBorders(16, 33, 16, 33)
__________________
¨¨°º©©º°¨¨°º©CHERONAPH©º°¨¨°º©©º°¨¨
Reply With Quote
  #15  
01-02-2004, 11:40 AM
Dialhot Dialhot is offline
Free Member
 
Join Date: May 2003
Posts: 10,463
Thanks: 0
Thanked 0 Times in 0 Posts
Excuse me but there is no mergeluma command in your script
Reply With Quote
  #16  
01-02-2004, 11:40 AM
incredible incredible is offline
Free Member
 
Join Date: May 2003
Location: Germany
Posts: 3,189
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to incredible
Sorry ... this should work now:
Code:
Mpeg2Source("E:\Muumipeikko ja hattivatit\VIDEO_TS\vts_01.d2v") 

video = SeparateFields() 

evenfield = SelectEven(video). 
\asharp(1, 4). 
\BicubicResize(320, 510, 0, 0.6, 0, 1, 720, 574). 
\StmedianFilter(3,3,1,1). 
\MAroutine() 

oddfield = SelectOdd(video). 
\asharp(1, 4). 
\BicubicResize(320, 510, 0, 0.6, 0, 1, 720, 574). 
\StmedianFilter(3,3,1,1). 
\MAroutine() 

Interleave(evenfield,oddfield) 
MergeChroma(blur(1.5))
Weave() 

AddBorders(16, 33, 16, 33)
@ Dialhot
He is right in quoting the error mess.

Seems to be a bug of the merge command (silly error message you're right and makes no sense). As the merge combinates the orig and the blurred image there could be a reference problem. So I put the Merge/Blur after the MA routine where it should came out as the same result. And as it does not work temporal its enough to let it work at separated field mode only.

At first I was wondering too cause I do not use MergeLUMABlur in the new MA routine anymore as Unfilter() already blurs on slow/even static scenes.
Reply With Quote
  #17  
01-02-2004, 01:03 PM
CheronAph CheronAph is offline
Free Member
 
Join Date: Feb 2003
Location: Espoo, Finland
Posts: 494
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to CheronAph
Half of the screen is green!?
__________________
¨¨°º©©º°¨¨°º©CHERONAPH©º°¨¨°º©©º°¨¨
Reply With Quote
  #18  
01-02-2004, 01:19 PM
incredible incredible is offline
Free Member
 
Join Date: May 2003
Location: Germany
Posts: 3,189
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to incredible
Ohhhh, Shure its wrong!!!
And also I quoted your script where your wrong resizing values where included!

So the problem is in your case that you did resize the progressive way!
In FitCD or Moviestacker you have to choose "interlaced" in the resizing options. that means the height is divided by a half! Cause of the separated fields!
(In my case here it worked perfekt using right interlaced resizing height values)

Code:
Mpeg2Source("E:\Muumipeikko ja hattivatit\VIDEO_TS\vts_01.d2v") 

video = SeparateFields() 

evenfield = SelectEven(video). 
\asharp(1, 4). 
\BicubicResize(320, 255, 0, 0.6, 0, 1, 720, 287). 
\StmedianFilter(3,3,1,1). 
\MAroutine() 

oddfield = SelectOdd(video). 
\asharp(1, 4). 
\BicubicResize(320, 255, 0, 0.6, 0, 1, 720, 287). 
\StmedianFilter(3,3,1,1). 
\MAroutine() 

Interleave(evenfield,oddfield) 
MergeChroma(blur(1.5)) 
Weave() 

AddBorders(16, 33, 16, 33)
I just corrected the height resizing to half!
BUT you should use the values given by moviestacker in interlaced output!

BTW:
I hope your source is really interlaced and NOT Telecined or just shown as interlaced by DVD2Avi (=no combing artefacts).

And you are using an overscan of 16 px at the sides on a 352x288(240) stream! You know that these borders will be double sized when watching on tv, so you could recognise them. My recommendation is to use in this case an overscan of 1 = 8px
Reply With Quote
  #19  
01-02-2004, 02:08 PM
CheronAph CheronAph is offline
Free Member
 
Join Date: Feb 2003
Location: Espoo, Finland
Posts: 494
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to CheronAph
It is interlaced yes, I got it now, my script is looking like this,

Mpeg2Source("E:\Muumipeikko ja hattivatit\VIDEO_TS\vts_01.d2v")

video = SeparateFields()

evenfield = SelectEven(video).
\asharp(1, 4).
\BicubicResize(336,272,0,0.6,4,0,712,28.
\StmedianFilter(3,3,1,1).
\MAroutine()

oddfield = SelectOdd(video).
\asharp(1, 4).
\BicubicResize(336,272,0,0.6,4,0,712,28.
\StmedianFilter(3,3,1,1).
\MAroutine()

Interleave(evenfield,oddfield)
MergeChroma(blur(1.5))
Weave()

AddBorders(8,16,8,16)
__________________
¨¨°º©©º°¨¨°º©CHERONAPH©º°¨¨°º©©º°¨¨
Reply With Quote
  #20  
01-02-2004, 02:13 PM
incredible incredible is offline
Free Member
 
Join Date: May 2003
Location: Germany
Posts: 3,189
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to incredible
On the first view now it seems ok, as the height is treated by a half.

But .... how does it look, everything ok? Just a script says nothing.

Scroll to a Scenechange and have a look at a frame before the scenechange ... does this frame blur a bit? If yes the MA routine works fine.
Reply With Quote
Reply




Similar Threads
Thread Thread Starter Forum Replies Last Post
Avisynth: best Deinterlacer script? andybno1 Avisynth Scripting 23 08-31-2004 11:46 AM
KVCD: what would be the best deinterlacer to use? Paul0889 Video Encoding and Conversion 1 01-26-2004 05:52 PM
Recording Video: Bob deinterlacer, then how to bring down the framerate? syk2c11 Video Capturing / Recording 2 08-21-2003 01:00 PM
Avisynth: Difference between MA script and optimal script? mistermickster Avisynth Scripting 2 08-01-2003 09:36 AM
Avisynth: Latest script using Avisynth 2.51 J-Wo Avisynth Scripting 6 04-08-2003 11:46 AM




 
All times are GMT -5. The time now is 04:56 AM  —  vBulletin © Jelsoft Enterprises Ltd