PDA

View Full Version : Displaying AviSynth frames


Cyberia
15th September 2003, 07:33
I am in the process of writing an AviSynth GUI (in VB) with the ability to display the output in a preview window. Currently I am rendering the output through a mediaplayer ocx. But I am having some problems with this implementation. (see this (http://forum.doom9.org/showthread.php?s=&threadid=61219) thread)

I am wondering how difficult it would be to render AviSynth frames directly. I am reasonably good with VB and I have used Bitblt in test projects previously. The only problem I can forsee is this: I will need the output frame from AviSynth and have no idea how to get it.

Is there a mechanism to do this already? (there must be, I assume) Would I need to continuously request the current frame from AviSynth? (obviously I will need to keep Bitblting the current frame)

Any help would be apreciated.

sh0dan
15th September 2003, 09:15
Using env->Invoke("Import"....), it should be possible to load a filter graph, by importing the script you need opened. That way you are given a PClip as AVSValue, from which you can extract the frames.

I have NO idea how to do this in VB - this is how it could be done in C++.

Cyberia
15th September 2003, 17:20
Can you show me an example? Converting C <-> VB is very much like trying to translate two foreign languages. Context is everything.

Bidoche
16th September 2003, 13:57
Avisynth do just that when exporting to vfw (invoking Import, getting a PClip..)
Sorry but I was unable to find the location of this code in my sources. :p

sh0dan
16th September 2003, 23:16
I don't think it would be possible in VB - at least you'd have to know how to do it to pull it off. You would be accedding C++ classes (PClip, AVSValue, etc), which I don't think is possible in VB. In c++ you might be able to do it easier, but I'd stick to VFW.

Richard Berg
17th September 2003, 08:38
C++ example, if this helps


#include <iostream>
#include <string>

#include "avisynth.h"

using namespace std;

int main(int argc, char* argv[])
{
IScriptEnvironment * avsEnv = CreateScriptEnvironment();

string script;
cout << "Type a script command: ";
cin >> script;

PClip clip = avsEnv->Invoke("Eval", script.c_str()).AsClip();

VideoInfo vi = clip->GetVideoInfo();
cout << "Resulting clip is " << vi.height << " by " << vi.width << " pixels" << endl;


return 0;
}



Obviously there are a lot more fun members of PClip than GetVideoInfo, but this should give you an idea of the steps.