View Full Version : Avisynth and FFMPEG

29th March 2005, 03:54
Hi all,
I am the author of an FFMPEG front end GUI called PSP Video 9 (http://www.pspvideo9.com). It uses FFMPEG to encode PSP MP4 videos. I'd like to include AviSynth support so I can better support various windows codecs (wmv, rm, etc).

The author of the compiled FFMPEG binary I use has some how incorporated this functionality into his own program and I wish to do the same. However being Japanese, its difficult to understand how he did this. The program in question is called 3GP Converter (http://www.nurs.or.jp/~calcium/3gpp/).

He has made the source code of his DLL interface to AviSynth available here (http://www.nurs.or.jp/~calcium/3gpp/sources/), though not being much of a Win32 programmer, I can't make much of it. My general theory is he is some how serving each frame to ffmpeg.

Does anyone with a bit more experience know how he's pulling this off?


29th March 2005, 07:37
I assume your talking about AVSredirect.dll? If not, just ignore this :D. If so, then the method is: dynamically load avisynth.dll (LoadLibrary), use GetProcAddress to obtain a function pointer to the CreateScriptEnvironment function. Use this function to create a new IScriptEnvironment and then call env->invoke with "Eval" or "Import" to evalute an avisynth script.. or you can call "AviSource" or whatever you want. invoke will return you a clip from which you can call getframe to get the needed frames and then you can get the pointers so you can pass the data on to another place (feed it to ffmpeg for instance). There is an example using the same method here: http://forum.doom9.org/showthread.php?threadid=64431&highlight=%2Ainvokeeval%2A I think there was another example using this method, but can't seem to find it now. Hope that helped at least a little.

29th March 2005, 18:16
Might be easier just to use Avs2YUV:

Usage is as follows:
avs2yuv "z:\whatever.avs" - | ffmpeg -f yuv4mpegpipe -i - -target dvd etc etc
from the command line

guada 2
1st April 2005, 16:41
Hello pspvideo9,

Would you think to integrate avs on your tool?
It would be interesting for small formats.

12th April 2005, 00:59
Just as a follow up, the ffmpeg binary that we use can indeed support AVS files from the command line as long as the AVSredirect.dll file is present in the same directory as the ffmpeg.exe.