Log in

View Full Version : Reading AviSynth output in C++


wonkey_monkey
12th October 2011, 14:18
Hi,

I've more-or-less got the hang of writing AviSynth plugins, but now I'd like to write something in C++ (preferably with as little "++" as possible) that will let me open and read frames from an AviSynth file.

Can anyone recommend some simple source code I could look at to get an idea of how to do things?

Or, alternatively, can anyone tell me that I'd be better off looking into VFW APIs and just opening an AVI file - because I could do it that way too, but I thought AviSynth might be more flexible in the future.

David

talen9
12th October 2011, 15:01
I suppose that avs2yuv (http://akuvian.org/src/avisynth/avs2yuv/) could be something like what you're looking for .. it takes an AVS file as an input, feeds it to AviSynth and you get an YUV stream as the output; maybe in the source you'll find something useful.

BTW, I know that there's a more up to date version of the program, look around in the forum for it, I don't have the link just here and now...

StainlessS
12th October 2011, 15:02
Hi David, suggest AVSTimer, I think it's in the New Plugins sticky (last page probably).
Have not yet lookd at it but it's supposed to be a simple timer & statistics for AVS's.
I asked for source to use as example for just the same thing.

StainlessS
12th October 2011, 16:00
Hi again David,
The link to AVSTimer (http://forum.doom9.org/showthread.php?p=1510246#post1510246)
in the New plugins thread, gives a bad or deleted file message from MediaFire, to v106 by user Groucho2004.
He must have just deleted it from MediaFire when he set up this thread:

http://forum.doom9.org/showthread.php?t=162155

TheFluff
12th October 2011, 18:33
avs2yuv does exactly what you're looking for and is only around 250 lines of code. Just use that as a reference.

talen9
13th October 2011, 14:20
BTW, I found the link for the patched avs2yuv I mentioned before .. here (http://forum.doom9.org/showthread.php?p=1527698#post1527698) it is :)

wonkey_monkey
13th October 2011, 17:56
Thanks everyone - I've had a quick look at the avs2yuv source and it looks the way to go.

David

wonkey_monkey
15th October 2011, 18:06
...well, almost. Both AVSMeter and avs2yuv do all their AVISynth stuff within int main() {...}, but when I try and do what they're doing in a function, it causes an exception as soon as the function returns, and I'm utterly clueless! Any more ideas of what I could look at, preferably a full win32 program?

David

Gavino
15th October 2011, 20:17
Possibly a problem in the cleanup/destructors.
Can you post your code (or at least an outline if it's very long)?

wonkey_monkey
15th October 2011, 22:53
As a result of some Googling I linked my project to avisynth.lib instead of loading avisynth.dll as avs2yuv and AVSMeter do - that seems to have solved the exception and I can now read frames.

Thanks for the help!

David