Log in

View Full Version : About Avisynth script writing


killerhis
13th March 2003, 20:03
Hi... I'm a newbee... well actually, i've studied all Avisynth filters and some other plugins... so i know all the basic stuff. But i've got not a lot of experience with scrip writing! This is my first actual script:

#version 1.0 alpha

#variable

end_sub_frame = 300
subtitle_color = $FFFFFF
end_mov_frame = 3000

#Plugins

LoadPlugin("C:\program files\avisynth 2.5\plugins\mpeg2dec_avisynth25\mpeg2dec.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\MPEG2Dec3 v1.00\MPEG2Dec3.dll")
LoadPlugin("C:\program files\avisynth 2.5\plugins\decomb406b6\decomb.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\dup201\Dup.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\FluxSmooth-1.0\FluxSmooth-2.5.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\MPEGDecoder_YV12\MPEGDecoder.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\msharpen100\MSharpen.dll")

#source file

mpeg2source("C:\ripping\video.d2v", cpu=4, iPP=true)

#interlaced

FieldDeinterlace(full=true)
YV12toYUY2(interlaced=true)



#editing

Crop(2, 6, -2, -6)
BicubicResize(576, 320)
Trim(0, end_mov_frame)

#subtitle

Subtitle("KillerHIS", x=72, y=63, first_frame=50, last_frame=end_sub_frame, font="Impact", size=30, text_color=subtitle_color)
Subtitle("Gam3R", x=83, y=86, first_frame=75, last_frame=end_sub_frame, font="Impact", size=30, text_color=subtitle_color)

#debug

#Showframenumber()
#Greyscale()
#Tweak(hue = -15, sat = 5, bright = 50, cont = 8)
#FreezeFrame(50, 500, 25)
#Loop(10,100,110)
#SelectRangeEvery(280, 14)
#Histogram()
#Info()


So anyone can give me some advice how i can do this better or improve speed???

I want to apply IVTC on a "PAL Interlaced" movie (at leased that DVD2AVI says).. but i can't get it to work.. anyone got any sugestions about that also... please post your advice here

thnkz

KillerHIS

sh0dan
13th March 2003, 20:24
FieldDeinterlace(full=true)
YV12toYUY2(interlaced=true)


Your material is no longer interlaced after you deinterlaced it. Use 2.5.1 and ConvertToYUY2().

Wait with the conversion until after the resize. This will make it slightly faster.

Do you need to have the video in YUY2 - what's your destination application?

killerhis
13th March 2003, 20:32
my destination application is finaly virtualDubMod.. i've used YUY2, because when i was practasing, some filters requered YUY2.. but now it doesn't has any function. But what's better for Encoding, YUY2, YV12 or RGB??

And still want to IVTC a PAL movie.. how do i do that?

sh0dan
13th March 2003, 20:45
IVTC is for NTSC material. For a partially interlaced PAL movie you should try Telecide(guide=2) and see if that gives better results. If not - stick to fieldddeinterlace.

Be sure to try Dup - it might help you achieve better results on anime - Try dup(threshold=1.5, copy=true, blend=true) with the latest 2.20 which can be found on this forum.

killerhis
13th March 2003, 21:29
OK.. thankz for the tip.. BUT what about my script.... how can i do it better. Any other tips are welcome!

Guest
14th March 2003, 00:55
Originally posted by sh0dan
Your material is no longer interlaced after you deinterlaced it. Use 2.5.1 and ConvertToYUY2().

Wait with the conversion until after the resize. This will make it slightly faster.

Do you need to have the video in YUY2 - what's your destination application? This is interesting, sh0dan. An interlaced YV12 has a particular sampling where a chroma sample applies to every other line, rather than 2 successive lines. Deinterlacing with a smart deinterlacer will not change that in the static picture areas. I argue that the interlaced upsampling is still required even after such deinterlacing.

It might be better to convert the color space using interlace=true before applying the decombing.

sh0dan
14th March 2003, 17:43
I actually thought of this, when I made the suggestions for you in your PM. I'll open a thread in the dev-forum.

Interlaced math in YV12 is frustrating complex. Another thing is that I don't have any telecined material to test on - but that problem is more easily solved.

trbarry
15th March 2003, 07:10
I went looking and didn't find any thread on this yet in the dev forum so I guess I'll reply here.

I still do not believe that you need to do interlaced color conversion after deinterlace or IVTC. But I guess I'm willing to be convinced (or ignored).

It's true that once something is stored in interlaced 4:2:0 that information has been lost. And this is not just due to the lower number of color samples but also due to the interpolation loss that occurs from the awful way that interlaced 4:2:0 must be stored.

But I still think that each stored chroma pixel represents the best (remaining) guess about the value of some pixel point in space and time. And after deinterlacing that should still be true.

The difference in deinterlacing is that now you have more (twice as many) points in space that supposedly represent the same point in time, the current frame. So if you are doing color conversion from deinterlaced source you can interpolate from points spaced closer together and hopefully get a more accurate answer.

I'm not saying you would get the same answer as if the 4:2:0 was stored in progressive frames to begin with. I'm just saying that deinterlace followed by progressive conversion will come closer to that answer.

- Tom