Log in

View Full Version : mg262 Motion.dll. How to interpolate 23.976 to 60fps?


Jeremy Duncan
2nd June 2008, 10:49
This is the code I want to use, from the mvtools readme.

To double fps with MVFlowFps for fastest (almost) real-time playing:

# assume progressive PAL 25 fps or NTSC Film 23.976 source
backward_vec = source.MVAnalyse(blksize=16, isb = true, chroma=false, pel=1, searchparam=1, idx=1)
# we use explicit idx for more fast processing
forward_vec = source.MVAnalyse(blksize=16, isb = false, chroma=false, pel=1, searchparam=1, idx=1)
source.MVFlowFps(backward_vec, forward_vec, num=2*FramerateNumerator(source), \
den=FramerateDenominator(source), mask=0, idx=1)

I want to use this for ntsc dvd movies that will be played from the disk.

Since the movie is 23.976 fps, and my monitor is stuck at 60 fps.
I have a problem if I double the fps of 23.976!
I need to change 23.976, to 29.970.
So when I double the frame rate it fits better into my monitors frame rate!

Can you tell me how to do this.

I tried a few different things with no success.
Please help me here. :)

Edit. This this the script I will be working with in ffdshow in realtime:

SetMtmode(2,10)
source=ffdshow_source()
source=changefps(source,source,true)
# assume progressive PAL 25 fps or NTSC Film 23.976 source
backward_vec = source.MVAnalyse(blksize=16, isb = true, chroma=false, pel=1, searchparam=1, idx=1)
# we use explicit idx for more fast processing
forward_vec = source.MVAnalyse(blksize=16, isb = false, chroma=false, pel=1, searchparam=1, idx=1)
source.MVFlowFps(backward_vec, forward_vec, num=2*FramerateNumerator(source), \
den=FramerateDenominator(source), mask=0, idx=1)
distributor()

When you give me the code for how to change the fps of the film to 29.970, I will try and put it in this code I just added.
And tips would be appreciated. :)

pandy
2nd June 2008, 14:46
This is the code I want to use, from the mvtools readme.


+++cut+++
source.MVFlowFps(backward_vec, forward_vec, num=1.25*FramerateNumerator(source), \
den=FramerateDenominator(source), mask=0, idx=1)
distributor()


Should fit Your request

Blue_MiSfit
2nd June 2008, 23:49
In real time? really? I can't see this working well!

Look into ReClock, or using the EVR renderer. They're both designed to fix the whole 24p-on-a-60hz-screen business.

~MiSfit

Jeremy Duncan
3rd June 2008, 02:08
http://img110.imageshack.us/img110/5577/mvtoolsvp0.th.jpg (http://img110.imageshack.us/my.php?image=mvtoolsvp0.jpg)

SetMtmode(2,3)
source=changefps(30000, 1001 ,true)
distributor()
SetMtmode(2,3)
source=ffdshow_source()
source=changefps(source,source,true)
# assume progressive PAL 25 fps or NTSC Film 23.976 source
backward_vec = source.MVAnalyse(blksize=16, isb = true, chroma=false, pel=1, searchparam=1, idx=1)
# we use explicit idx for more fast processing
forward_vec = source.MVAnalyse(blksize=16, isb = false, chroma=false, pel=1, searchparam=1, idx=1)
source.MVFlowFps(backward_vec, forward_vec, num=2*FramerateNumerator(source), \
den=FramerateDenominator(source), mask=0, idx=1)
distributor()

I got this code to run fine, but when I closed the mpc. It wouldn't start again without crashing.

I can change the fps using this code:

SetMtmode(2,3)
source=changefps(30000, 1001 ,true)
distributor()

As long as I keep ffdshow video source checked in ffdshow avisynth.

Once I uncheck that, then changefps always brings errors.
The thing about this mvtools code below:

SetMtmode(2,3)
source=ffdshow_source()
source=changefps(source,source,true)
# assume progressive PAL 25 fps or NTSC Film 23.976 source
backward_vec = source.MVAnalyse(blksize=16, isb = true, chroma=false, pel=1, searchparam=1, idx=1)
# we use explicit idx for more fast processing
forward_vec = source.MVAnalyse(blksize=16, isb = false, chroma=false, pel=1, searchparam=1, idx=1)
source.MVFlowFps(backward_vec, forward_vec, num=2*FramerateNumerator(source), \
den=FramerateDenominator(source), mask=0, idx=1)
distributor()

is I must uncheck ffdshow video source.

So, I cannot change the fps using changefps it seems.

And the suggestion made by pandy didn't work.
A multiple of 2.5 instead of 1.25 didn't work either.
I get a error saying those numbers with decimals can't be used.

But that first code did run fine for a few minutes before I turned mpc off! :stupid:
So it can be done, I guess.

And it runs fine on my e6600 at stock speed.

I'm hoping for some more suggestions. :thanks: :script:

Edit
This code works, but I only get 48fps.

SetMtmode(2,3)
ffdshow_source()
source=changefps(30000, 1001 ,true)
backward_vec = source.MVAnalyse(blksize=16, isb = true, chroma=false, pel=1, searchparam=1, idx=1)
forward_vec = source.MVAnalyse(blksize=16, isb = false, chroma=false, pel=1, searchparam=1, idx=1)
source.MVFlowFps(backward_vec, forward_vec, num=2*FramerateNumerator(source), \
den=FramerateDenominator(source), mask=0, idx=1)
distributor()

When I change changefps(60000...
it stutters pretty bad in movie.

Any idea why I only get 48fps. It seems to be ignoring the 29.970 fps I made. :confused:

Edit.

I've settled on this ffdshow setting.

http://img525.imageshack.us/img525/5996/mvtoolsxg4.th.jpg (http://img525.imageshack.us/my.php?image=mvtoolsxg4.jpg)

SetMtmode(2,3)
ffdshow_source()
source=changefps(60000, 2002,true)
backward_vec = source.MVAnalyse(blksize=16, isb = true, chroma=false, pel=1, searchparam=1, idx=1)
forward_vec = source.MVAnalyse(blksize=16, isb = false, chroma=false, pel=1, searchparam=1, idx=1)
source.MVFlowFps(backward_vec, forward_vec, num=2*FramerateNumerator(source), \
den=FramerateDenominator(source), mask=0, idx=1)
distributor()

Jeremy Duncan
3rd June 2008, 08:00
I mentioned that I was stuck at 48 fps.
I managed to get 60 fps, but I had to use this code:

SetMtmode(2,3)
ffdshow_source()
source=ChangeFPS(37525,1001,true)
backward_vec = source.MVAnalyse(blksize=16, isb = true, chroma=false, pel=1, searchparam=1, idx=1)
forward_vec = source.MVAnalyse(blksize=16, isb = false, chroma=false, pel=1, searchparam=1, idx=1)
source.MVFlowFps(backward_vec, forward_vec, num=2*FramerateNumerator(source), \
den=FramerateDenominator(source), mask=0, idx=1)
distributor()

The reason I'm posting this is I want to know if everything looks ok in this code.
It lets me get 60fps in my 60Hz monitor.

scharfis_brain
3rd June 2008, 08:24
why do you all set changefps BEFORE mvtools?
THis will introduce dupes or drop resulting in uneven motion.

just set the output framerate in mvflowfps:

source=last
backward_vec = source.MVAnalyse(blksize=16, isb = true, chroma=false, pel=1, searchparam=1, idx=1)
forward_vec = source.MVAnalyse(blksize=16, isb = false, chroma=false, pel=1, searchparam=1, idx=1)
source.MVFlowFps(backward_vec, forward_vec, num=60, den=1, mask=0, idx=1)

nothing more needed.
also don't use mt with mvtools. it simply doesn't work good (at all).

I personally prefer motion.dll from mg262.
it is able to deliver 100fps up to 1280x720 pixels on my q6600 (which it only uses one core from)

Jeremy Duncan
3rd June 2008, 12:23
ffdshow_source()
source=last
backward_vec = source.MVAnalyse(blksize=16, isb = true, chroma=false, pel=1, searchparam=1, idx=1)
forward_vec = source.MVAnalyse(blksize=16, isb = false, chroma=false, pel=1, searchparam=1, idx=1)
source.MVFlowFps(backward_vec, forward_vec, num=60, den=1, mask=0, idx=1)

This code doesn't make the fps fo past 50fps. While the last one I posted stays at 60fps.
I tested with fraps and mpc.

Maybe you can show what code to use with motion.dll to get the 60fps? :)

Edit.

I saw your post in the motion.dll thread.
You said to use this code, changing fps= to the monitors Hz.

LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\Motion_12Dec05.dll")
ffdshow_source()
fps=60
last.CombineFPS(fps, last. MotionFPS(fps, warpfast, move), last.MotionFPS(fps, source = next, warpfast, move))

So, I did that and it did not work. The video was choppy and unwatchable.

http://img217.imageshack.us/img217/5050/motiongg1.th.jpg (http://img217.imageshack.us/my.php?image=motiongg1.jpg)

Edit.

It was unwatchable because it was maxing out one core. Heh heh.
I set a new resize and it plays smooth.
But using this code below only gets my frame rate that never goes over 50fps:

LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\Motion_12Dec05.dll")
SetMtmode(2,3)
ffdshow_source()
fps=60 #last.framerate()*4
last.CombineFPS(fps, last. MotionFPS(fps, warpfast, move), last.MotionFPS(fps, source = next, warpfast, move))
distributor()

scharfis_brain
3rd June 2008, 19:10
the code I posted works directly in ffdshow.
it reaches 85fps / 85Hz without problems on ONE of the cores of my Q6600.

but the realtime interpolation quality of motion.dll is much better than the one of mvtools.dll.

I guess you got some issues with your graphics card or direct show filters.
try to not maximize the playback window.
If I enlarge playback window to more than 1280 pixels horizontally the result is jerky motion, cause my graphics card seems to have some bandwidth issues.

Have you tried the latest ffdshow tryouts?
Have you tried switching Overlay, VMR7, and VMR9 ?

Ans what is this mystical distributor()?

Jeremy Duncan
3rd June 2008, 23:28
Information on Distributor()
http://avisynth.org/mediawiki/MT_modes_explained


Distributor (defined in mt.cpp) creates as many threads as SetMTMode specifies. In this case two threads. Each thread waits for the distributor to assign a frame to work on. The current algorithm that is used for this is rather simple. If distributor is requested to deliver a frame n it will see if the frame is already done, if not it will assign it to the first idle thread that has generated a frame lower than n. If there is more than one idle thread they will be assigned to process the next frame not being currently being generated (so if thread1 is processing frame 10, thread2 is processing frame 11 and thread3 is done processing frame 9, when frame 10 is being requested thread3 would be assigned frame 12 as it is the next one being needed). So currently if the application that opens the AviSynth script doesn't access frames linearly with a delta of 1 frame there would be a lot of wasted time used on generating frames not needed (although the cache after Distributor will contain some of the frames so it is not entirely wasted).

As seen the two threads can collide in the same instance of the filters used. This can cause problems with filters not designed to allow thread safe access to class variables. To prevent this mode 2 was created:

I can't get motion.dll and your script to go past 48fps on my 60Hz monitor.
Cpu usage is around 50%, cores relatively balanced.

I tried at a resizing one multiple.
I'm using mpc default output and yv12 input/output in ffdshow.
I'm using ffdshow version 1897

Today I can resize to my screen resolution using your code for motion.dll. I ad trouble with that yesterday. Maybe the mt helped?

scharfis_brain
4th June 2008, 05:44
again: mt dows NOT work properly with mvtools and motion dll.
so do not use mt for them.

Jeremy Duncan
4th June 2008, 07:47
Deleting the MT and distributor from the code doesn't change that I only get 48fps using your code, and 60fps using the code I mentioned that gives me 60fps.

I need changefps to be source=changefps, if I put changefps at the bottom of the code like below I get a error:
ffdshow_source()
backward_vec = source.MVAnalyse(blksize=16, isb = true, chroma=false, pel=1, searchparam=1, idx=1)
forward_vec = source.MVAnalyse(blksize=16, isb = false, chroma=false, pel=1, searchparam=1, idx=1)
source.MVFlowFps(backward_vec, forward_vec, num=2*FramerateNumerator(source), \
den=FramerateDenominator(source), mask=0, idx=1)
ChangeFPS(37525,1001,true)

I need to change this line to get rid of the error: source=ffdshow_source()

Then the fps is nowhere near 60fps. 24, 25fps I think.

scharfis_brain
4th June 2008, 08:24
but changefps negates using motion interpolation.
Changefps will introduce judder itself which cannot be undone by mvtools nor motion.dll.


I am running ffdshow tryouts revision 1723 Dec 24 2007 13:41:54

which settings do you use in your avisynth section of ffdshow?

I got:
[x] Add ffdshow video source
3:2 Pulldown: [Ignore Pulldown]
Input colorspaces: [x]YV12 [ ]YUY2 [ ]RGB24 []RGB32
[x] Buffer back/ahead [13] [13]
loadplugin("f:\x\Motion_12Dec05.dll")
loadplugin("f:\x\masktools.dll")
import("f:\x\motion.avs")
fps=85
last.CombineFPS(fps, last. MotionFPS(fps, warpfast, move), last.MotionFPS(fps, source = next, warpfast, move))


That is all I need to enable super-smooth motion.
I could even set it to put out 150fps (looks very nice with short shutter footage; almost 'real')

Jeremy Duncan
4th June 2008, 09:46
http://img232.imageshack.us/img232/5157/motionmq7.th.jpg (http://img232.imageshack.us/my.php?image=motionmq7.jpg)

I get 48fps on my ntsc movies using this code. Same as in the picture.

LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\Motion_12Dec05.dll")
ffdshow_source()
fps=60 #last.framerate()*4
last.CombineFPS(fps, last. MotionFPS(fps, warpfast, move), last.MotionFPS(fps, source = next, warpfast, move))

I'm watching a movie, but with that mvtools code that gives my 60fps without mt it keeps crashing ati catalyst every 40 minutes in the movie.

I'll try with motion.dll and the code above and see if it crashes catalyst on me.

scharfis_brain
4th June 2008, 17:28
do you use a dvd/mpeg2 ntsc-movie as input? this doesn't work properly cause of the pulldown flags.
if you use mpeg2 based movies, then multiply your desired framerate by 1.25 eg:

if you want 60 fps output for MPEG2 pulldowned movies, you have to set 60*1.25 = 75fps

Jeremy Duncan
4th June 2008, 22:51
do you use a dvd/mpeg2 ntsc-movie as input? this doesn't work properly cause of the pulldown flags.
if you use mpeg2 based movies, then multiply your desired framerate by 1.25 eg:

if you want 60 fps output for MPEG2 pulldowned movies, you have to set 60*1.25 = 75fps

Yeah, that works! :thanks:

If I was watching Pal Mpeg-2, and wanted to see 50fps. What would the fps be?
I think since it doesn't have pulldown flags it would be 50.

scharfis_brain
5th June 2008, 00:26
If I was watching Pal Mpeg-2, and wanted to see 50fps. What would the fps be?
I think since it doesn't have pulldown flags it would be 50.
yeah.
for common pal you don't need any correction factors.

Jeremy Duncan
5th June 2008, 00:31
Thanks Man. :thanks: