PDA

View Full Version : Reading an AviSynth clip in Java


nonoitall
6th November 2007, 01:35
What would the easiest way to do this be? I've been trying to use Avs2YUV, piping the information to my program, but while reading frames from Avs2YUV works perfectly, it refuses to print the clip's total length in frames to stderr when stderr is redirected to my program. (And I need to know the clip's length.) So... are there any other ways (preferably not horribly time-consuming to write) to read frames from an AviSynth script in Java and get the clip's length in frames?

Leak
6th November 2007, 13:13
So... are there any other ways (preferably not horribly time-consuming to write) to read frames from an AviSynth script in Java and get the clip's length in frames?
Other than accessing AviSynth's C interface (defined in avisynth_c.h) directly via JNI - I don't think so.

But since that's only a handful of functions it should not be too time-consuming. You'd get the added bonus of being able to actually seek around in the AviSynth clip returned from your script, among other things...

nonoitall
7th November 2007, 08:09
I think I'll port what I've written so far over to C# in that case then. A little easier to import stuff from DLLs that way, and I think a program written in C# that uses a Windows DLL might have a better chance of being run on Linux than a program written in Java that uses the JNI to access a Windows DLL. I looked over avisynth_c.h and it doesn't look quite as daunting as I thought it would be, so I'll give it a shot.

Is there any .NET library available yet that exposes avisynth.dll's functionality in an object-oriented way? If not, I might as well post my work when I'm done with it. BTW, if you run Avs2YUV with the -slave option, you can effectively seek to any frame in the clip, but then the issue I mentioned above presents itself - just FYI. ;) Thanks!

vlada
26th November 2007, 12:57
nonoitall
You might want to have a look at MeGUI. It is a C# program and it uses Avisynth.

chris.
3rd April 2010, 21:13
If anyone is trying to access AviSynth from a Java program, here is the JNI library that will do the trick.
http://sourceforge.net/apps/trac/javisynth