digitalFAQ.com Forums [Archives]

digitalFAQ.com Forums [Archives] (http://www.digitalfaq.com/archives/)
-   Avisynth Scripting (http://www.digitalfaq.com/archives/avisynth/)
-   -   Avisynth: best deinterlacer with MA script? (http://www.digitalfaq.com/archives/avisynth/7454-avisynth-best-deinterlacer.html)

CheronAph 01-01-2004 05:14 PM

best deinterlacer with MA script?
 
I have an interlaced dvd, what would be the best deinterlacer with MA script?

Dialhot 01-01-2004 05:17 PM

Don't really know if it's the best but I always use FieldDeinterlace when I need one.

CheronAph 01-01-2004 05:22 PM

What settings do you use, it seems a little slow?

Dialhot 01-01-2004 05:28 PM

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 ;-)

CheronAph 01-01-2004 05:32 PM

Ok, thanks!

incredible 01-01-2004 06:32 PM

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.

sbin 01-01-2004 11:22 PM

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.

kwag 01-01-2004 11:50 PM

Quote:

Originally Posted by sbin
simply discard one of the fields and resize

And throw away 50% of the information 8O
Not to mention the jagged lines you will get too.
Go here and look what you loose :!:
http://www.100fps.com

-kwag

sbin 01-02-2004 12:17 AM

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.

Dialhot 01-02-2004 03:13 AM

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 ?

incredible 01-02-2004 04:37 AM

@ 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.

Dialhot 01-02-2004 04:45 AM

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.

incredible 01-02-2004 09:40 AM

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)


CheronAph 01-02-2004 11:25 AM

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)

Dialhot 01-02-2004 11:40 AM

Excuse me but there is no mergeluma command in your script :!:

incredible 01-02-2004 11:40 AM

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.

CheronAph 01-02-2004 01:03 PM

Half of the screen is green!?

incredible 01-02-2004 01:19 PM

Ohhhh, Shure its wrong!!! :roll:
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

CheronAph 01-02-2004 02:08 PM

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,288).
\StmedianFilter(3,3,1,1).
\MAroutine()

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

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

AddBorders(8,16,8,16)

incredible 01-02-2004 02:13 PM

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.


All times are GMT -5. The time now is 07:12 PM  —  vBulletin © Jelsoft Enterprises Ltd

Site design, images and content © 2002-2024 The Digital FAQ, www.digitalFAQ.com
Forum Software by vBulletin · Copyright © 2024 Jelsoft Enterprises Ltd.