View Full Version : avisynth and variable (?) fps
yokaze
3rd June 2004, 09:47
I've been fooling around with CamStudio recently (one of them "desktop/screen recording software"). It comes with a lossless codec that's pretty decent... I can capture 1024x768 with low cpu usage during recording or playback.
Now I'm trying to overlay a small video over the screen recording: think tutorial videos with the tutor's head in a corner.
So far, my efforts are getting nowhere. Trying to overlay or make even simple modifications to the screen recording (even a simple resize) throws the synchronization totally off. Virtualdub reports wierd fps values (2000fps???) so I guess this codec is using some strange variable fps scheme. I tried using AssumeFPS or ConvertFPS but still no dice. I'm out of ideas and I'd appreciate any helpful advice. Thanks!
Guest
3rd June 2004, 12:51
Post a link to a short unprocessed source clip and the codec. Failing that, I don't see how we can help you.
yokaze
3rd June 2004, 17:21
A screen recording of me messing around in notepad.
(640x480, no audio, 15 seconds long, ~800kb)
http://yoyo.monash.edu.my/~yokaze/public/test.avi
And here's the codec:
http://yoyo.monash.edu.my/~yokaze/public/CamStudio_Lossless_Codec.zip
Just try loading the the avi and applying any simple operation, like a resize.
scharfis_brain
4th June 2004, 00:11
hmmm.
avisource("test.avi")
doesn't work well, but directshowsource("test.avi") works !
the codec seems to use 200 fps with exessive framedropping.
just fit the framerate of this clip to your need using
changefps(25)
where 25 is the framerate
(common framerates are: 25, 50, 23.976, 29.97, 59.94 )
so the whole script could look like this:
directshowsource("test.avi")
changefps(25)
lanczosresize(704,576)
yokaze
4th June 2004, 06:43
It loads, yes... but even with DirectShowSource the timing goes totally whacko. Closest I got to the correct timing was via:
DirectShowSource("test.avi")
AssumeFPS(7)
But then previewing it in mpc gives me a total time that's off by a magnitude. Besides, the AssumeFPS(7) seems pretty arbitrary. Isn't there a more "correct" way to get AviSynth to load the movie correctly?
(incidentally, I tried capturing at a more sane rate of 30fps. Same problem though)
stephanV
4th June 2004, 08:21
assumefps will changge the frame rate by slowing down or speeding up the video... thats why your playback time increased so much (by a factor 200/7).
use changefps, that will change the frame rate with keeping the original playback time. it does this by dropping frames. unfortunately, there will not be a real 'right' value to use for this. as it is difficult to estimate at what rate the capture is really made.
BTW - if your capturing from your screen when using other programs you should not expect more than something like 15 fps at the very most... probably you wont even get above 10 fps (but thats my personal experience).
good luck though :)
scharfis_brain
4th June 2004, 10:13
hehe, you have to recompress that AVI before you can use it with avisynth.
before compressing, go to
video -> framerate -> convert fps to xxxx <- fill in your desired value, to fit it to the video that you want to overlay...
then choose a compressor (XViD @ quant 1, or CorePNG with all options)
and save that avi
yokaze
4th June 2004, 12:07
Thanks for all the help guys, but I can't just manually guess the fps each time. For starters, there'll be an audio track later (mouse clicks, system sounds etc) which will probably go off sync, and the overlay video to be added won't necessarily be the same length (tutor's head sometimes there, sometimes not).
I've gone back to AviSource. Feeding in a 10fps test clip (http://yoyo.monash.edu.my/~yokaze/public/test3.avi), it looks like AviSynth isn't rendering the intermediate frames correctly. My current solution is to recompress in VirtualDub, forcing all frames to be keyframes. Bloats the filesize by 10x, but at least AviSynth seems to render it fine then.
I'm hoping for more elegent solutions though. Suggestions on fixing the rending problems anyone? :)
scharfis_brain
4th June 2004, 12:44
note: changefps(x) of AVISynth will NOT alter the A/V sync!
fps conversion of VIrtualdub won't change it, too!
so, just change the framerate to your need, to fit it to the video you want to overlay, AV sync is not affected by it!
yokaze
5th June 2004, 09:56
scharfis_brain:
Thanks for your help, I really appreciate it... but as far as I can tell, ChangeFPS doesn't work.
Try viewing the test3.avi file I posted earlier, in plain media player. The total length is around 13 secs, at a framerate of 10fps.
Using the following:
directshowsource("test3.avi").changefps(10)
The total length seems correct, but the movie is actually playing around twice as fast, ending around 6 secs.
Changing the number in ChangeFPS only drops or adds interpolated frames, but it doesn't change the fact that AviSynth appears to be compressing each frame's timeslot (sorry, I'm struggling for correct terminology here).
scharfis_brain
5th June 2004, 10:28
use avisource() with your recompressed file.
directshowsource often needs an fps parameter for correct runtime.
(this causes your time sqeezing)
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.