Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage
Register FAQ Calendar Today's Posts Search

Reply
 
Thread Tools Search this Thread Display Modes
Old 8th July 2006, 18:17   #21  |  Link
Clown shoes
King of the Jungle
 
Clown shoes's Avatar
 
Join Date: Mar 2003
Location: Shoreditch, London
Posts: 429
lol oh! Thanks Boulder. This is taken directly from my mvtools 1.30 documentation;


Description

MVFlowFps2 (clip, clip "mvbw", clip "mvfw", clip "mvbw2", clip "mvfw2", int "num", int "den", float "ml", int "idx", int "idx2")

Will change the framerate (fps) of the clip (and number of frames) like MVFlowFps, but with a little better quality (and slower processing). In addition to backward "mvbw" and forward "mvfw" motion vectors of original source clip, the function uses backward "mvbw2" and forward "mvfw2" motion vectors of second (modified) source clip. Second clip must be produced from original source clip by cropping (i.e. diagonal shift) by half block size. It must be done with command Crop(a,a,-b,-b), where a=b=4 must be used for blksize=8, a=b=8 for blksize=16, and a=2, b=6 for blksize=4 (see example). Blocks boundaries will be at different parts of objects. MVFlowFps2 reverses the shift internally and averages motion vectors from these two sources to decrease motion estimation errors. The function uses pixel-based motion compensation (as MVFlow, MVFlowInter). Internal forward and backward occlusion masks (MVMask kind=2 method) and time weighted factors are used to produce the output image with minimal artefactes. True motion estimation is strongly recommended for this function.

num: fps numerator (default=25)

den: fps denominator (default=1). Resulted fps = num/den.

ml: mask scale parameter. The greater values are corresponded to more weak occlusion mask (as in MVMask function, use it to tune and debug). Default=100.

idx (may be) works the same way as idx in MVAnalyse for speed increasing.

idx2 is MVAnalyse index of second (shifted) clip (must not coincide with first idx).



Usage

To change fps with MVFlowFps2:

# Assume progressive PAL 25 fps source. Lets try convert it to 50.
backward_vec = source.MVAnalyse(isb = true, truemotion=true, pel=2, idx=1)
# we use explicit idx for more fast processing
forward_vec = source.MVAnalyse(isb = false, truemotion=true, pel=2, idx=1)
cropped = source.crop(4,4,-4,-4) # by half of block size 8
backward_vec2 = cropped.MVAnalyse(isb = true, truemotion=true, pel=2, idx=2)
forward_vec2 = cropped.MVAnalyse(isb = false, truemotion=true, pel=2, idx=2)
return source.MVFlowFps2(backward_vec,forward_vec,backward_vec2,forward_vec2,num=50,idx=1,idx2=2)



I clearly have a lot of reading and learning to do, because I have no idea how you made the correlation between what's in the documentation and what you posted. I feel a bit stupid, much to learn...


@ Chainmax,

Thank you. I will try this now. Can I ask though, why assumefps(599.4,true) followed by changefps(59.94) Secondly, why does the audio need to be downsampled by a few hz? is there a part of this script that is causing the running time to change?

Last edited by Clown shoes; 8th July 2006 at 18:34.
Clown shoes is offline   Reply With Quote
Old 8th July 2006, 18:59   #22  |  Link
Chainmax
Huh?
 
Chainmax's Avatar
 
Join Date: Sep 2003
Location: Uruguay
Posts: 3,103
Because of rounding errors when calculation the fractions, the resulting framerate after the Interleave line will be something like 600.4fps. The AssumeFPS line brings it down to 599.4fps so that ChangeFPS can do a clean 10-to-1 decimation instead of a ~10.0167-to-1 one.
Now, AssumeFPS changes framerate by changing the speed of the video, and while a 0.15% slowdown will never be noticeable, audio and video will become very slightly asynch. The true switch in the AssumeFPS line corrects that by altering the samplerate of the audio to avoid that asynch, which is why you'll need to resample afterwards.
SSRC can't do such minor (~ 0.0070% or less) adjustments, which is why I recommended SRCDrop.


P.S:mmm...I wonder if ChangeFPS can be substituted by TDecimate...
__________________
Read Decomb's readmes and tutorials, the IVTC tutorial and the capture guide in order to learn about combing and how to deal with it.
Chainmax is offline   Reply With Quote
Old 8th July 2006, 19:02   #23  |  Link
Didée
Registered User
 
Join Date: Apr 2002
Location: Germany
Posts: 5,391
Chainmax, that script seems incorrect to me. The offsets you're specifying are all integers: 1/11=[zero], 2/11=[zero], etc. When I try that script, it results in just one duplicate field every 6th field, practically the same as going the good old Bob.ChangeFps.SelectEvery.Weave road. For getting that result, DePan is not even needed...
When changing the offsets to floats, as expected: 1./11. , 2./11. , etc. then: there is indeed "true" motion throughout all fields of the output, but also the "oddities" from interpolation are there again ...

Alas, currently I have to try with an older version of DePan. On Fizick's site I see no download link to the current version ... and since Fizick currently is in vacation (supposely), I can't ask him, though being a "supporter" ...
__________________
- We´re at the beginning of the end of mankind´s childhood -

My little flickr gallery. (Yes indeed, I do have hobbies other than digital video!)

Last edited by Didée; 8th July 2006 at 19:04.
Didée is offline   Reply With Quote
Old 8th July 2006, 19:52   #24  |  Link
Boulder
Pig on the wing
 
Boulder's Avatar
 
Join Date: Mar 2002
Location: Finland
Posts: 5,733
Do you mean this one : http://avisynth.org.ru/depan/depan17.zip
__________________
And if the band you're in starts playing different tunes
I'll see you on the dark side of the Moon...
Boulder is offline   Reply With Quote
Old 8th July 2006, 20:04   #25  |  Link
Didée
Registered User
 
Join Date: Apr 2002
Location: Germany
Posts: 5,391
Oh, it's indeed there. Thanks for the hint.

Going the official road, you end up in this depan page, which doesn't contain a download link.
__________________
- We´re at the beginning of the end of mankind´s childhood -

My little flickr gallery. (Yes indeed, I do have hobbies other than digital video!)
Didée is offline   Reply With Quote
Old 8th July 2006, 20:58   #26  |  Link
Boulder
Pig on the wing
 
Boulder's Avatar
 
Join Date: Mar 2002
Location: Finland
Posts: 5,733
That's where I got the link It's just down at the bottom of the page, second line from the end. It's easy to miss because there is just the latest version available whereas many other filters of his have all the versions for downloading.
__________________
And if the band you're in starts playing different tunes
I'll see you on the dark side of the Moon...
Boulder is offline   Reply With Quote
Old 8th July 2006, 21:24   #27  |  Link
Didée
Registered User
 
Join Date: Apr 2002
Location: Germany
Posts: 5,391
Eh, now we have it: my browser stopped before loading the complete document, probably because of a timeout. Hence I had no link. Sorry for the noise

BTW, to make your above example script for 25p --> 29.97i work correctly, needed changes were:

- replace "1/11" with "1./12." and so on for the rest
- replace "input_1_of_12 = input" with "input_1_of_12 = input.duplicateframe(0)"

Result is free or artefacts, of course. But really good it is only on clear pans. On "globally still" frames, all in-frame motion still is stuttering ... and on some difficult scenes (global shift to one side, but big objects moving to the other side), the stutter is, well, funny.
No surprise, though ... depan is doing exactly what it's designed to do: shifting the frame as a whole.
__________________
- We´re at the beginning of the end of mankind´s childhood -

My little flickr gallery. (Yes indeed, I do have hobbies other than digital video!)
Didée is offline   Reply With Quote
Old 8th July 2006, 21:39   #28  |  Link
Clown shoes
King of the Jungle
 
Clown shoes's Avatar
 
Join Date: Mar 2003
Location: Shoreditch, London
Posts: 429
Are you saying that script is for 25p to 29.97i ? Would that be no good for my 25i footage then?
Clown shoes is offline   Reply With Quote
Old 8th July 2006, 22:21   #29  |  Link
Trixter
Registered User
 
Join Date: Oct 2003
Posts: 209
Quote:
Originally Posted by Trixter
Where did you get MotionprotectedFPS? I don't think I've seen that, and am curious to know what it does...
Scratch that, I found it.

...and after testing it for about 30 minutes, I have to say that I like MVTools' MVFlowFPS2 much better -- the decrease in speed is well worth the estimation accuracy. I'll stick with them.
Trixter is offline   Reply With Quote
Old 8th July 2006, 22:24   #30  |  Link
Didée
Registered User
 
Join Date: Apr 2002
Location: Germany
Posts: 5,391
Arrrr...

With the noted changes, you can use it. I did miss that at the end of the loooooong mpeg2source-line, Chainmax had put a small ".MVBob()".
(I didn't even look at the end of that line, because I'm not used to put any filters in that place -- that's not exactly "structured scripting" ...)

So, for what the "interlacing impaired" person I am can see, the following should be correct for you:
Code:
Import("C:\Program Files\AviSynth 2.5\plugins\mvbob\mvbob.avs")

LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\DePan.dll")

input = MPEG2Source("I:\Gucci NTSC M2Vs\Alexander McQueen Women.d2v")
input = input.MVBob()

vectors = depanestimate(input)
input_1_of_12 =  input.duplicateframe(0)
input_2_of_12 =  input.depan(vectors,offset= 1./12.,mirror=15,blur=35)
input_3_of_12 =  input.depan(vectors,offset= 2./12.,mirror=15,blur=35)
input_4_of_12 =  input.depan(vectors,offset= 3./12.,mirror=15,blur=35)
input_5_of_12 =  input.depan(vectors,offset= 4./12.,mirror=15,blur=35)
input_6_of_12 =  input.depan(vectors,offset= 5./12.,mirror=15,blur=35)
input_7_of_12 =  input.depan(vectors,offset= 6./12.,mirror=15,blur=35)
input_8_of_12 =  input.depan(vectors,offset= 7./12.,mirror=15,blur=35)
input_9_of_12 =  input.depan(vectors,offset= 8./12.,mirror=15,blur=35)
input_10_of_12 = input.depan(vectors,offset= 9./12.,mirror=15,blur=35)
input_11_of_12 = input.depan(vectors,offset=10./12.,mirror=15,blur=35)
input_12_of_12 = input.depan(vectors,offset=11./12.,mirror=15,blur=35)
interleave(input_1_of_12,input_2_of_12,input_3_of_12,input_4_of_12,input_5_of_12,input_6_of_12,
 \         input_7_of_12,input_8_of_12,input_9_of_12,input_10_of_12,input_11_of_12,input_12_of_12)

AssumeFPS(599.4,true)
ChangeFPS(59.94)

ConvertToYUY2()
Lanczos4Resize(width,480)
Assumetff().SeparateFields().SelectEvery(4,0,3).Weave()
But again: on scenes without "global motion", (only some objects within the frame are moving), the result basically will still just be one duplicate field for every 6th field. It's only the panning scenes that benefit.
__________________
- We´re at the beginning of the end of mankind´s childhood -

My little flickr gallery. (Yes indeed, I do have hobbies other than digital video!)

Last edited by Didée; 8th July 2006 at 22:26.
Didée is offline   Reply With Quote
Old 8th July 2006, 22:27   #31  |  Link
Trixter
Registered User
 
Join Date: Oct 2003
Posts: 209
Quote:
Originally Posted by Chainmax
Code:
vectors=depanestimate(input)
input_1_of_12 = input
input_2_of_12 = input.depan(vectors,offset=1/11,mirror=15,blur=35)
input_3_of_12 = input.depan(vectors,offset=2/11,mirror=15,blur=35)
input_4_of_12 = input.depan(vectors,offset=3/11,mirror=15,blur=35)
input_5_of_12 = input.depan(vectors,offset=4/11,mirror=15,blur=35)
input_6_of_12 = input.depan(vectors,offset=5/11,mirror=15,blur=35)
input_7_of_12 = input.depan(vectors,offset=6/11,mirror=15,blur=35)
input_8_of_12 = input.depan(vectors,offset=7/11,mirror=15,blur=35)
input_9_of_12 = input.depan(vectors,offset=8/11,mirror=15,blur=35)
input_10_of_12 = input.depan(vectors,offset=9/11,mirror=15,blur=35)
input_11_of_12 = input.depan(vectors,offset=10/11,mirror=15,blur=35)
input_12_of_12 = input.depan(vectors,offset=11/11,mirror=15,blur=35)
interleave(input_1_of_12,input_2_of_12,input_3_of_12,input_4_of_12,input_5_of_12,input_6_of_12,input_7_of_12,input_8_of_12,input_9_of_12,input_10_of_12,input_11_of_12,input_12_of_12)

AssumeFPS(599.4,true)
ChangeFPS(59.94)
Sweet Lincoln's Mullet, what is this doing? Why 12 different motion vector calcs, and why the up-to-600-then-back-to-60? How is this better than MVFlowFPS(2)?
Trixter is offline   Reply With Quote
Old 8th July 2006, 22:37   #32  |  Link
Trixter
Registered User
 
Join Date: Oct 2003
Posts: 209
Quote:
Originally Posted by Clown shoes
import("C:\Program Files\AviSynth 2.5\plugins\mvbob\mvbob.avs")
import("C:\Program Files\AviSynth 2.5\plugins\MotionProtectedFPS.avsi")
MPEG2Source("E:\SC tests\AmcQ.d2v")
mvbob()
motionprotectedfps(59.94)
lanczos4resize(width,480)
converttoyuy2()
assumetff().separatefields().selectevery(4,0,3).weave()
If you want Helios-like results without attempting your own threshold masking, that's pretty much it. For slightly better estimation at the cost of processing speed, you can use MVFlowFPS2, already a part of mvconv() in the mvbob.avs you import. Give this a shot and see if it works better with your difficult footage:

Code:
import("C:\Program Files\AviSynth 2.5\plugins\mvbob\mvbob.avs")
MPEG2Source("E:\SC tests\AmcQ.d2v")
mvbob()
mvconv()
lanczos4resize(width,480)
converttoyuy2()
assumetff().separatefields().selectevery(4,0,3).weave()
(BTW if you have an older version you might get a script error on "convertttoyuy2" not being found... edit mvbob.avs and fix the typo to "converttoyuy2".)
Trixter is offline   Reply With Quote
Old 8th July 2006, 22:41   #33  |  Link
Clown shoes
King of the Jungle
 
Clown shoes's Avatar
 
Join Date: Mar 2003
Location: Shoreditch, London
Posts: 429
Trixter, can you see anything wrong with my implementation of mvflowfps2.

import("C:\Program Files\AviSynth 2.5\plugins\mvbob\mvbob.avs")
MPEG2Source("I:\JUMP_BRITAIN\Jump Britain.d2v")
mvbob()
loadplugin("C:\Program Files\AviSynth 2.5\plugins\mvtools.dll")
vvbw=MVAnalyse(truemotion=true,blksize=8,delta=1,pel=2,isb=true,idx=3,chroma=true,sharp=1)
vvfw=MVAnalyse(truemotion=true,blksize=8,delta=1,pel=2,isb=false,idx=3,chroma=true,sharp=1)
vvbw2=MVAnalyse(last.Crop(4,4,-4,-4,true),truemotion=true,blksize=8,delta=1,pel=2,isb=true,idx=4,chroma=true,sharp=1)
vvfw2=MVAnalyse(last.Crop(4,4,-4,-4,true),truemotion=true,blksize=8,delta=1,pel=2,isb=false,idx=4,chroma=true,sharp=1)
MVFlowFPS2(last,vvbw,vvfw,vvbw2,vvfw2,idx=3,idx2=4,num=6000,den=1001)
converttoyuy2()
lanczos4resize(width,480)
assumetff().separatefields().selectevery(4,0,3).weave()


It is giving me amazing results except for some warping on fast moving scenes. I have posted a still on the previous page. This is not something that is apparent when I use motionprotectedfps though. Is there a fundemental difference between the two that may explain this. Or is it just my use of the filter?
Clown shoes is offline   Reply With Quote
Old 8th July 2006, 22:46   #34  |  Link
Didée
Registered User
 
Join Date: Apr 2002
Location: Germany
Posts: 5,391
Well, it's the typical "choose-your-poison" situation:
The depan-method is virtually free of artefacts, but will leave motion of moving objects stuttering. In some special situations, slight "backward-motion" phenomenae may occur.
The MVFlowFps/2 method will interpolate all motion, big or small one, but is prone to produce artefacts on not-compensateable motion (e.g. un/hidening objects).

There is no inbetween.
__________________
- We´re at the beginning of the end of mankind´s childhood -

My little flickr gallery. (Yes indeed, I do have hobbies other than digital video!)
Didée is offline   Reply With Quote
Old 9th July 2006, 00:24   #35  |  Link
foxyshadis
Angel of Night
 
foxyshadis's Avatar
 
Join Date: Nov 2004
Location: Tangled in the silks
Posts: 9,559
Well, there is, but most of the research in that area is locked up with the brainiacs of Snell & Wilcox. MVFlow is about the best available with the currently available research; there should be ways to obtain a better confidence estimate for covered/uncovered objects but Clouded once told me that it's a lot harder than it sounds. Snell & Wilcox use algorithms that attempt to identify and track individual objects through an occulsion (how, I couldn't say, but I can guess the basics), but mvtools is nowhere near that strong/slow.
foxyshadis is offline   Reply With Quote
Old 9th July 2006, 00:25   #36  |  Link
Clown shoes
King of the Jungle
 
Clown shoes's Avatar
 
Join Date: Mar 2003
Location: Shoreditch, London
Posts: 429
Sorry Didee, I was actually comparing mvflowfps2 and motionprotectedfps which uses mg262s motion filter.
Clown shoes is offline   Reply With Quote
Old 9th July 2006, 03:11   #37  |  Link
Didée
Registered User
 
Join Date: Apr 2002
Location: Germany
Posts: 5,391
@ foxyshadis

Yeah. What I meant was "there is no inbetween with our current filters for Avisynth."
Ways to deal better with the problem surely do exist. I'd even have a bunch of 'em in front of my inner eye ... but who cares for those flatbrained scripters that can't even code a hello-world proggy in some modern C mutation.


@ Clown shoes

Yep, I know. My last post was directed at Trixter ... too much simultaneous posting back then.

Regarding MVFlowFPS/2 -vs- MotionProtectedFPS:
While these two use different methods to do the vector search, technically they fight the very same problems, and in fact even their results are very similar. What makes them appear so different at first glance (you noticed that MotionFPS comes out with less artefacts) is that, with default(!) settings, MotionFPS is more cautious about avoiding artefacts than MVFlowFPS. The key is the "ml" value in MVFlowFPS, which defaults to "80". Try setting "ml" to, say, "1000" instead, and then compare both again. You'll see that MVFlowFPS2 now has much less artefacts. Probably it now even has a slight edge over MotionFPS. Still, MotionFPS comes very close ... and it comes in at much faster speed.
__________________
- We´re at the beginning of the end of mankind´s childhood -

My little flickr gallery. (Yes indeed, I do have hobbies other than digital video!)
Didée is offline   Reply With Quote
Old 9th July 2006, 03:46   #38  |  Link
Chainmax
Huh?
 
Chainmax's Avatar
 
Join Date: Sep 2003
Location: Uruguay
Posts: 3,103
I was using integers instead of floats? No wonder those "." were there in the readme .

Didée: it's funny that you mentioned the stuttering, I was showing portions of the video to my GF and at some point I jumped to a very stuttery scene. It's really disappointing since the script was doing so well on some of the most difficult scenes .
You give me, however, a spark of hope: you say artifacts decrease as ml increases, which setting would you say results in zero artifacts? Would such setting have negative effects besides speed (which is of no concern to me)?
__________________
Read Decomb's readmes and tutorials, the IVTC tutorial and the capture guide in order to learn about combing and how to deal with it.

Last edited by Chainmax; 9th July 2006 at 04:00.
Chainmax is offline   Reply With Quote
Old 9th July 2006, 04:03   #39  |  Link
Didée
Registered User
 
Join Date: Apr 2002
Location: Germany
Posts: 5,391
Well, zero artefacts is out of reach ... except for not doing any framerate conversion
Also, I've little clue what the safe zone for "ml" might be ... it's just today that I fiddled as much with framerate conversion as in the whole past year ... ml=1000 was just a random shot at some random high value. Seems to work not too bad, however ...

edit - speed should be about the same, since the protection work is done anyway. Somewhat similar like in MaskedMerge, where it won't matter if the mask covers almost all pixels, or just a few.
__________________
- We´re at the beginning of the end of mankind´s childhood -

My little flickr gallery. (Yes indeed, I do have hobbies other than digital video!)

Last edited by Didée; 9th July 2006 at 04:08.
Didée is offline   Reply With Quote
Old 9th July 2006, 04:09   #40  |  Link
Chainmax
Huh?
 
Chainmax's Avatar
 
Join Date: Sep 2003
Location: Uruguay
Posts: 3,103
I'll try to see what setting for ml reduces artifacting the most in my clips and report back. In any case, how about this: a new parameter that would be linked to the artifacting (no idea how) and if it exceeds or falls below a user-defined threshold then the frame in question would be replaced by an interpolation of the previous and next frame?
__________________
Read Decomb's readmes and tutorials, the IVTC tutorial and the capture guide in order to learn about combing and how to deal with it.
Chainmax is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 23:55.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.