Log in

View Full Version : Using AviSynth in C without VfW


omion
24th March 2008, 04:26
I am writing a program in the OCaml language, and I want to be able to access AviSynth directly to get frames from an AVS file.

The problem is that in order to link anything to OCaml I need to use a C interface (not C++), and I can't find any resources on how exactly to do that. It looks like there is a method of loading the DLL in C++ (avs2yuv does it), and there are headers and a library for doing plugins in C, but I don't know how to connect the two.

In the end, I want to be able to do something like this (in OCaml):
let avs = open_avs("some_file.avs");;
let big_fat_string = get_nth_frame(avs,20);;
close_avs(avs);;
Or something similar.

I looked into the VfW interface, but it doesn't look like it will output in YV12, which I need.

I have the C/OCaml interface covered, but I don't know enough C to figure out how to wedge AviSynth into the program.

Ideally, if somebody could post a little C snippet that would approximate the above code, that would be the most helpful. Any other suggestions would be appreciated as well.

Thanks!

omion
24th March 2008, 08:45
Nevermind. I think I got it figured out. I didn't realize I could call avs_create_script_environment, then invoke the "Import" filter with the AVS file as an argument.
I'm now dishing out frames in OCaml! :cool: