View Full Version : How can avisynth's filter merge 2 frames
skaven65536
2nd August 2004, 23:40
at first, sorry for my poor English :)
2) I want to create an Avisynth's filter which will fix some problems with fields, so it should create one frame from two.
I've found a method in IScriptEnvironment, which allows you to add new frames, but how I can delete frames from PClip, if I want to recieve only half number of frames?
sh0dan
2nd August 2004, 23:49
You need to get your basics in place.
Look around the FilterSDK (http://www.avisynth.org/FilterSDK), look at the samples. Download sources for other filters, search this forum, etc.
PS. Hint: You change the number of frames in a clip, by adjusting "num_frames" in the "Videoinfo vi" struct, passed along with the PClip you are receiving as source.
Leak
2nd August 2004, 23:54
Originally posted by skaven65536
at first, sorry for my poor English :)
2) I want to create an Avisynth's filter which will fix some problems with fields, so it should create one frame from two.
I've found a method in IScriptEnvironment, which allows you to add new frames, but how I can delete frames from PClip, if I want to recieve only half number of frames?
Well, in short:
* In your filter's constructor you halve vi.num_frames which means your filter will return half as many frames as it gets passed in
* In your filter's GetFrame method you get frames 2*n and 2*n+1 from your child PClip, do something with them and return your fixed frame
You might of course take a look at the source for my BlendBob filter (http://forum.doom9.org/showthread.php?sthreadid=80289) which does exactly that, among other things... :D
np: Sixtoo - Funny Sticks Reprise (Chewing On Glass & Other Miracle Cures)
skaven65536
3rd August 2004, 21:56
Originally posted by Leak
Well, in short:
* In your filter's constructor you halve vi.num_frames which means your filter will return half as many frames as it gets passed in
* In your filter's GetFrame method you get frames 2*n and 2*n+1 from your child PClip, do something with them and return your fixed frame
You might of course take a look at the source for my BlendBob filter (http://forum.doom9.org/showthread.php?sthreadid=80289) which does exactly that, among other things... :D
np: Sixtoo - Funny Sticks Reprise (Chewing On Glass & Other Miracle Cures)
ok, thanks. So, if I want to get 1 frame from 4th and 5th frames, in GetFrame for 4th frame I should decrease vi.num_frames in GetFrame for 4th frame and return one frame?
Leak
3rd August 2004, 23:06
Originally posted by skaven65536
ok, thanks. So, if I want to get 1 frame from 4th and 5th frames, in GetFrame for 4th frame I should decrease vi.num_frames in GetFrame for 4th frame and return one frame?
No, you have to set the final number of frames you're going to return in the constructor of your filter - you can't change it afterwards. Of course this also means you can't just randomly add or remove frames... :(
(I guess this is mainly due to the fact that AviSynth works via VfW's AVI interface, which doesn't allow changing the number of frames on the fly...)
np: Company Flow - Tragedy Of War (In III Parts) (Funcrusher Plus)
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.