Log in

View Full Version : Compare() and AssumeFPS() problem


sysKin
15th September 2002, 13:57
Hi everyone.

I'm using Compare() function to compute psnr between avi encoded with xvid and original avi encoded with huffyuv. It works great, but I would like to have the comparsion made as soon as I can, not as long as the movie plays.
I found assumefps() function which changes fps without affecting the picture.
When I tried the following:
orig = avifilesource("f:\war3.avi")
encoded = avifilesource("e:\test.avi")
assumefps(encoded, 100, 1, false)
assumefps(orig, 100, 1, false)
compare(encoded, orig, "", "test.log", false)
then assumefps() had no effect.

However, when I try the following:
orig = avifilesource("f:\war3.avi")
encoded = avifilesource("e:\test.avi")
compare(encoded, orig, "", "test.log", false)
assumefps(encoded, 100, 1, false)
assumefps(orig, 100, 1, false)
then assumefps has it's effect indeed, but compare() doesn't work! It just outputs Comparing channel(s) YUV

Mean Max Max
Absolute Mean Pos. Neg.
Frame Dev. Dev. Dev. Dev. PSNR (dB)
-----------------------------------------------------



Total frames processed: 0

Minimum Average Maximum
Mean Absolute Deviation: 0.0000 -1.#IND 0.0000
Mean Deviation: +0.0000 -1.#IND +0.0000
PSNR: 0.0000 -1.#IND 0.0000


Can you tell me what I'm doing wrong?
If it's a bug, I can give you this (possibly useful) information:
* if I have both assumefps()s then the logfile is opened and closed immidietly, and I can delete it even while the video is playing
* if I have only one assumefps() - doesn't matter which one - then the logfile is opened and stays open until I close the video (just as if it was waiting for the first frame to process)
* any assumefps() before compare() has completely no effect, just as if it wasn't there
* if I say 'true' for the on-screen graph, then the graph is not there if I use assumefps() (just like the logfile is not there)

OK, dunno what next, just ask. Or tell me what I'm doing wrong ;)

Radek 'sysKin' Czyz

dividee
15th September 2002, 15:08
For properly using Compare with a logfile, you need to understand how avisynth request frames. That's because writing to the logfile is a side effect (the purpose of a filter is to produce an output clip, not to write a logfile), and - as all side effect functions - is a bit nasty. The last filter in the script produce the output, and this filter is responsible for calling the other filters.
In your first script, AssumeFPS has no effect since it isn't called by Compare: Compare refers to the "orig" and "encoded" clips from the source. This is probably what you're trying to achieve:

orig = avifilesource("f:\war3.avi")
encoded = avifilesource("e:\test.avi")
encoded = assumefps(encoded, 100, 1, false)
orig = assumefps(orig, 100, 1, false)
compare(encoded, orig, "", "test.log", false)

Although I fail to understand what AssumeFPS buys you here.

In the second script, assumefps(orig, 100, 1, false) is responsible for calling other filters, and it refers only to the source "orig" clip, so the resulting clip is equivalent to the one obtained with just avifilesource("f:\war3.avi").assumefps(100, 1, false).
The logfile is still created because filters are instantiated when the script is interpreted, but it's never called afterward.

sysKin
15th September 2002, 15:33
Originally posted by dividee
In the second script, assumefps(orig, 100, 1, false) is responsible for calling other filters, and it refers only to the source "orig" clip, so the resulting clip is equivalent to the one obtained with just avifilesource("f:\war3.avi").assumefps(100, 1, false).

Thank you for your answer. Using avifilesource("f:\war3.avi").assumefps(100, 1, false) did the trick :D I can compute an average psnr of 3-minute clip in just above one minute (I think I'll overclock my pc a bit more ;> )

All the information about how avisynth works will be useful, too. Thanks again.

Radek

-h
15th September 2002, 19:44
Thank you for your answer. Using avifilesource("f:\war3.avi").assumefps(100, 1, false) did the trick :D I can compute an average psnr of 3-minute clip in just above one minute (I think I'll overclock my pc a bit more ;> )

If you're just looking to blast through the .avs file as fast as you can to generate the log file, you could have loaded it up in VDub, and chose XviD as the compressor using "Null mode (test speed)". That'll just request frames from the frameserver as fast as it can serve them up, but just write null frames to the AVI. Pete added it as a decompression speed test.

-h

dividee
15th September 2002, 22:46
OK now I understand why you want AssumeFPS. What I usually do to speed test avisynth scripts is, in vdub, set audio to No audio, video to Direct Stream Copy, press F9 (to disable "display input video"), F10 (disable "display output video")and F5 (launch preview). No need to speed up the clip.

Marc FD
17th September 2002, 17:59
And don't forget to use Fast Compress Mode (YUY2) with Preview (F5) !!!
you'll not see the preview, but the speed will override all limitations, and it would be much faster (no RGB conv).
i can use Compare at 35 fps like this :devil: