Log in

View Full Version : Negative frame number in 2.5.7 RC1?


Trixter
4th October 2006, 00:55
For the life of me I can't figure out why this script:


import("d:\program files\avisynth 2.5\plugins\mvbob\mvbob.avs") # avisynth version is really 2.5.7
AVISource("MakingOfWingCommander3.avi").ConvertToYUY2.BilinearResize(720,480)
mvbob
ConvertMCfps(num=24000,den=1001)


...is giving me negative frame numbers. See this VirtualDub screenshot:

http://img81.imageshack.us/img81/1049/avisynthbadframestz5.png

As a result, I can't get it to load in anything. Is this something wrong with avisynth or Scarfis_Brain's mvbob scripts (which many many others have no problem with)? How can I troubleshoot this?

Fizick
4th October 2006, 05:02
what mvbob version do use use?

try replace MVTools.dll from mvbob package to newest version 1.4.13 from my site.

IanB
4th October 2006, 08:33
Try adding...
Info()
Trim(0,100)to the end of your routine. How many frames does Info() say there are?

Replace the mvbob() with dumb Bob() and check the results.

Then replace the ConvertMCfps() with simple ConvertFPS() and recheck the results.

Which function is causing the problem?

Trixter
6th October 2006, 03:16
what mvbob version do use use?

The latest one from Scarfis, September 16th.

try replace MVTools.dll from mvbob package to newest version 1.4.13 from my site.

Okay, trying now...

Didn't help :-(

Trixter
6th October 2006, 03:48
Try adding...
Info()
Trim(0,100)to the end of your routine. How many frames does Info() say there are?

A crazy amount :-( See below:

http://img168.imageshack.us/img168/4042/wtfframesgf3.th.png (http://img168.imageshack.us/my.php?image=wtfframesgf3.png)


Replace the mvbob() with dumb Bob() and check the results.


Same result.

Then replace the ConvertMCfps() with simple ConvertFPS() and recheck the results.

Now it works. I replaced bob() with mvbob() and it still works. So ConvertMCFPS (and also mvconv from his older mvbob release) are the troublemakers.

Now, ConvertMCFPS/mvconv are just shortcuts for doing it myself, right? So let me try it myself:


loadplugin("D:\Program Files\AviSynth 2.5\plugins\mvtools.dll")
AVISource("MakingOfWingCommander3.avi")
Crop(0,2,720,480) # original is 720x486; this gets us to 720x480, preserving field order
ConvertToYUY2

function my_mvconv(clip c)
{
backward_vec = c.MVAnalyse(isb = true, truemotion=true, pel=2, idx=1)
# we use explicit idx for more fast processing
forward_vec = c.MVAnalyse(isb = false, truemotion=true, pel=2, idx=1)
cropped = c.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 c.MVFlowFps2(backward_vec,forward_vec,backward_vec2,forward_vec2,num=24000,den=1001,idx=1,idx2=2)
}

bob
my_mvconv


...and it breaks again :-(

Here's something even weirder: When I try the above code with a 3m55s 720x576 PAL source, it works ok. When I try it with my original 21m57s 720x486 NTSC source, I get the negative frame behavior (unusable). Help?

Fizick
6th October 2006, 15:49
try with other sources,
Maybe your is bad. What is its info without convertfps?

may be trim a few original frames and upload it to some server.

try also complitely clean your plugins autoload folder

Trixter
7th October 2006, 04:26
try with other sources,
Maybe your is bad. What is its info without convertfps?

Without any processing, avisynth shows 720x486, 29.97.

may be trim a few original frames and upload it to some server.

That's an excellent idea -- I tried a 5 second file and the problem is still there, so please use this file:

http://rapidshare.de/files/35786088/smalltestfootage.7z.html

...with this script:


loadplugin("D:\Program Files\AviSynth 2.5\plugins\mvtools.dll")
AVISource("smalltestfootage.avi")
Crop(0,2,720,480) # original is 720x486; this gets us to 720x480, preserving field order
ConvertToYUY2

function my_mvconv(clip c)
{
backward_vec = c.MVAnalyse(isb = true, truemotion=true, pel=2, idx=1)
forward_vec = c.MVAnalyse(isb = false, truemotion=true, pel=2, idx=1)
cropped = c.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 c.MVFlowFps2(backward_vec,forward_vec,backward_vec2,forward_vec2,num=24000,den=1001,idx=1,idx2=2)
}

bob
my_mvconv


..and you should be able to reproduce the bug as well.

try also complitely clean your plugins autoload folder

I don't autoload any plugins.

Fizick
7th October 2006, 12:34
Trixter,
I do not like 7z.
Can you upload AVI ?
I have slow connention, may be about 10 frames will be enough?

Trixter
7th October 2006, 18:47
Sure, here's http://rapidshare.de/files/35859634/tinytest.zip which is 3.5MB and 10 frames. It still exhibits the problem in the previous script I posted.

Please let me know what you find :-)

Fizick
7th October 2006, 22:51
o.k., i download it.
I found 'crazy' numerator and denominator of source fps.
29.97 = 10000000/333667

I wil try fix this bug in some next version of MVTools.
New Avisynth does not produce such nice values.

Workaround:
Add Assumefps(29.97) or Assumefps(30000,1001) before ConverttoYUY2

Trixter
8th October 2006, 15:20
Excellent detective work!!! How did you find the num/den values in the source file?

The .avi was produced by Premiere Pro 1.5 using Blackmagic Design hardware and codecs (although one of them = plain UVYV as you saw). I'll definitely keep this in mind if I run into similar problems.

You wrote "New Avisynth does not produce such nice values." I don't understand your wording; are you implying that avisynth keeps the values normal, or that avisynth should be fixed to deal with values like this?

Thanks so much, this means I can get to my real work now (transcoding 3 hours of footage, yay for me ;-)

Fizick
8th October 2006, 15:50
How did you find the num/den values in the source file?


Info()

Trixter
8th October 2006, 16:00
Whoops :o

Thanks for discovering it and the workaround.

Fizick
8th October 2006, 16:30
From changes list of Avisynth 2.5.7:

* xxxFPS("preset") string preset FPS values. (Tritical)
...
* xxxFPS(float) now uses continued fraction to generate a minimal rational pair. (Raymod2)

IanB
9th October 2006, 04:58
@Fizick,

You may find the Range protected multiply-divide of FPS, vi.MulDivFPS(mult, div), helpfull in defending against strange input values in your pluggins.

The script verb AssumeScaledFPS() make use of this to avoid exactly these intermediate overflow problems.