File Exchange

image thumbnail


version 1.1 (65 KB) by

Read videos into matlab using avisynth. (Avisynth has to be installed on your system)

1 Download


View License

Read video frames into matlab using avisynth, or retrieve an info struct with information about the video. Input can be a video, an avisynth file or a cell-array of avisynth commands. Not as fast as the videoIO toolbox (about 2 times as slow), but faster than all the other video readers I have tried for matlab. The main purpose is of course the posibility to use avisynth commands. As long as you have the correct codecs installed on your system, avisynthReader can read the video.

Matlab file-exchange doesn`t provide mex-files anymore, but this can be found at

Comments and Ratings (8)

I don`t think you can mix 32 bit and 64 bit like that... I guess I would try 32 bit matlab if I were you.

Russell Wyeth

I was able to get it to compile by replacing the standard avisynth.h with the 64-bit version available here:

However, the mex file now throws the same error: it can't load the avisynth.dll. I tried specifying its path explicitly in mavs.cpp prior to compilation, and it still didn't work. I think it may be because the dll is a 32-bit file, while Matlab and mavs mex file are 64 bit. I don't want to switch to 64 bit Avisynth - it's out-of-date, and will cause incompatibilities elsewhere. So unless there is a way to get 64 bit Matlab to work with the standard dll, I think perhaps I should just use 32 bit Matlab.

Russell Wyeth

I've tried it with both the 2.5.8 and 2.6.0 src files. Same problem, either way.

I don`t think what compiler you use should matter. This error seems to be in the avisynth files and not in my mavs.cpp file (just a waring in mavs.cpp). Is it the source files for the latest avisynth release?

Russell Wyeth

Thanks for the quick response Ivar. Compiling it myself produced the following error:

>> mex mavs.cpp
d:\documents\tech\programming\matlab\usercontrib\avisynthreader_1.0_src\avisynth\src\core\avisynth.h(574) : error C2821: first formal parameter to 'operator new' must be 'size_t'
mavs.cpp(84) : warning C4267: 'initializing' : conversion from 'size_t' to 'int', possible loss of data

D:\PROGRA~1\MATLAB~2\BIN\MEX.PL: Error: Compile of 'mavs.cpp' failed.

Unfortunately, I was not able to get the Visual C++ 2008 compiler to work on my system. Matlab directed me to this SDK instead, which includes the Visual C++ 2010 compiler. Could that be the problem?

I think the mex file is compiled for 32 bit matlab, this might be the issue. You can compile a new mex file for 64 bit, there are instructions inside the mavs.cpp file.

Russell Wyeth

Has this been tested with the latest Avisynth release? I downloaded the mex files from sourceforge and they are accessible on my path, but still get this error:
Error using mavs
Could not load library avisynth.dll

Error in avsReader (line 45)
out = mavs( filename, framenr );

I suppose it may also be 32 vs 64 bit complexities.
My system: Win7 64 bit, Matlab2012b 64 bit, AviSynth2.6.0 (32 bit), avisynth.dll is located in SysWOW64 folder.


Gordon (view profile)

Great functions, I've been looking to use avisynth in Matlab for ages, wish I'd found this earlier.

Remember to download avisynth installation and source from so you can compile the mexfile and get things to run



Removed mex file and added source...

MATLAB Release
MATLAB 7.5 (R2007b)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video