Forums [Archives] Forums [Archives] (
-   Avisynth Scripting (
-   -   Avisynth: Converts 60fps Video into 24fps? (

kwag 01-20-2004 11:24 AM

Avisynth: Converts 60fps Video into 24fps?
This is the script I use to convert my 29.97fps Interlaced (non-telecined!) movies to 23.976fps.
The function convert60ito24p is from scharfis_brain, whose site is here:
Just change the relevant lines to what your source and target will be, using MovieStacker or FitCD.
And also, this script (my portion) is not really optimized. But it just works great :)



## DLL Section ##



BicubicResize(336, 448, 0, 0.6, 0, 0, 720, 480)
STMedianFilter(3, 3, 0, 0 )

ScriptClip(" 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) , 1, 1)  ")

AddBorders(8, 16, 8, 16)

############### the function #############
function convert60ito24p (clip video, int mode, int offset)
work = assumefieldbased(video)
out = (mode==2) ? interleave(
\layer(trim(work, 1, 0),
\layer(work, trim(work, 2, 0), "fast"),
\"fast"), 5, 0 + offset),
\layer(work, trim(work, 1, 0), "fast"), 5, 3 + offset)) :
\    (mode==1) ? interleave(
\selectevery(trim(work, 1, 0), 5, 0 + offset),
\selectevery(layer(work, trim(work, 1, 0), "fast"), 5, 3 + offset)) :
\    (mode==0) ? selectevery(work, 5, 1 + offset, 4 + offset) : work

## Functions ###

function fmin( int f1, int f2) {
  return ( f1<f2 ) ? f1 : f2

incredible 01-20-2004 02:05 PM

Hi Kwag, you where fast, cause Im writing a interlacing-deinterlacing Guide and its basics which I also wanted to post as sticky as the last weeks there where a lot of Threads according to this and its encoding problems. :)

I see you're still using a simple bob above, I did some tests a time ago using


as it works smart and only the combed parts will be treated.

Even more quality gives

Smoothdeinterlace(doublerate=true, TFF=true, blend=false).selectodd()

EDIT: In case of the 60ito24p function as showed above you HAVE TO USE: Smoothdeinterlace(doublerate=true, TFF=true, blend=false) WITHOUT Selectodd() !! As a full 60fps deinterlacer is needed!
Also be aware which fieldorder is used in the source in case of "bottomfield first" use TFF=false! And also here do test blend with true or false as shown below.

... wich won't result in blendings but only good on Videos which do not contain fine static! text and lines ... but the image comes out more clear, more sharp (even deinterlaced parts) and do have the right contrast which disappears when frames come out blended.

Did you try to do first the filtering on the fieldbased data and afterwards doing the 29.976:arrow:23.976 conversion?

Here a little comparison of the blending in case of deinterlacing (just a part of the guide) watch the drops above right. All images here are safed in Jpeg, quality 45%

And here comes a sample where we should use blend=true (no matter if fielddeinterlace() or Smoothdeinterlace() ... as you see very fine Typo is contained which would be destroyed but her eyes do look correct.
Because the typo is static and blend=false would cause problems.
I know that Girl Sonja from the station Pro7 does have everything a man really wants ;-)

kwag 01-20-2004 03:00 PM


Originally Posted by incredible
I see you're still using a simple bob above, I did some tests a time ago using


as it works smart and only the combed parts will be treated.

Yes I know, but as I posted, the script is not optimized. It just works fine as it is, and anyone is free to improve it.
It was just posted as a basic framework, to be improved upon ;)
Obviously, Smoothdeinterlace is far better :)


incredible 01-20-2004 03:16 PM

:D YEP! You're right I did read to fast as you mentioned it, but as we know some noobs could read even more faster and just eat the food they see.

I only say one word: "maxThreshold" in MA :D

You can also use Fielddeinterlace(full=false,blend=false)
but I did the last weeks a lot of tests and Smoothdeinterlace with doublerate and discarted evenfields ("selectodd()") did look better.

GFR 01-26-2004 07:08 AM

Any suggestions for a smooth progressive 29.97 fps source (like an avi or mpeg-1) to 23.976 fps convertion?[/b]

incredible 01-26-2004 07:43 AM

a progressive 29.97 ???? Are you shure?

Well in that case if NO! interlacing apperas in fast moving areas, you just perform a

wich inverses the pulldown ... means RESTORES the amount of 29.97 Frames per second to 23.976 FPS. IF the movie is in a correctly pulldowned state!

or use

(look for the plugin at Warpenterprises)
It gots a threshold routine inside which auto detects the pulldown method within your source. But still risky as it works smart ;-)

Boulder 06-12-2004 01:57 AM

Here's a developed version of the original function (props to scharfis_brain and Manao):



#the rest as usual

You'll need the following:

- MVTools.dll, see my next post
- MVConvert60ito24p(), see my next post
- KernelDeint() , must be version 1.5 or above!,

The original discussion thread is here:

Replace order=x by order=1 for top field first video or order=0 for bottom field first video.

Boulder 06-12-2004 02:16 AM

Here's the version which works with v0.9.3:


function mvconvert60ito24p(clip x, int "mode")

mode = default(mode,2)

vectorsforward = x.mvanalyse(isb = false)
vectorsbackward = x.mvanalyse(isb = true)

y = x.mvinterpolate(vectorsbackward, vectorsforward, nb = 4, bl = 0.5 - mbl, el = 0.5 + mbl, wf = "hat")


(mode==0) ? mode0 : (mode==1) ? mode1 : (mode==2) ? mode2 : mode3


Boulder 08-31-2004 10:35 AM

The latest script is now up-to-date again. The only change was that KernelBob is now included in KernelDeint since v1.5.0.

dongxu 09-09-2004 04:52 PM

I tried mvconvert60ito24p to convert 29.97 to 23.976 in order to save some bits for movie and found it considerably slowed the encoding speed. Is it normal or my script needs optimising. I put mvconvert60ito24p before other actions such as Crop, BicubicResize and AddBorders.

Boulder 09-10-2004 01:13 AM

Doing the conversion is very slow, that's normal. The function that Kwag posted might be faster, but you'll have to remember that the script I posted evolved from that one as both are scharfis_brain's creations.

All times are GMT -5. The time now is 09:38 AM  —  vBulletin Jelsoft Enterprises Ltd

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