File Exchange

image thumbnail

DirectShow (DirectX) based AVI file reader

version 1.6.0.0 (49.9 KB) by Ashwin Thangali
This library provides a simple matlab interface to read large AVI files (> 2Gb) and most codecs

4 Downloads

Updated 23 May 2012

View License

This library contains helper functions to read image frames into Matlab from an AVI file using DirectShow on Windows. It hence,

a) does not suffer from the 2Gb file size limit of the VFW based Matlab aviread
b) handles most codecs installed on the system
c) has functions quite similar to aviread

*** Depending on your Matlab version, renaming the .mexw32 files to .dll may work.

*** Jose Ignacio Gomez Espinola has kindly shared his code and instructions to compile dxAvi for win64 (64 bit Windows) here,
http://www.mathworks.com/matlabcentral/fileexchange/36790

*** If you wish to get the binaries directly and save a whole lot of hassle with building this library, please Google dxAvi, dxAvi_64 to obtain the pre-compiled files.

-- testDxAvi.m is a simple example.
The library usage is as follows,

[avi_hdl, avi_inf] = dxAviOpen(avi_filename);

pixmap = dxAviReadMex(avi_hdl, frame_num);

img = reshape(pixmap,[avi_inf.Height,avi_inf.Width,3]);

dxAviCloseMex(avi_hdl);

** If your avi file fails to open: in ffdshow configuration (ffdshow is available in Klite pack) set the decoder for the corresponding video format to "libavcodec".

Notes:
*** dxAvi needs BaseClasses directory from "Direct X 9.0 SDK 2002" (Google should get you this), code here is based on GrabBitmaps.cpp in DirectShow samples.

*** dxAvi needs zlib.lib from the zlib-1.2.5 or more recent library.

*** It seems that recent versions of Windows no longer ship with the SampleGrabber DirectShow filter that dxAvi relies on to intercept data from the DirectShow video rendering graph. If your system is missing this filter you would need to install 'qedit.dll' also available in the precompiled library mentioned earlier in System32 and SYSWOW64 directories. To register this directshow filter, from windows command line execute:

On 32bit systems use:
C:\WINDOWS\system32\regsvr32.exe System32\qedit.dll

On 64bit systems use:
C:\WINDOWS\system32\regsvr32.exe SYSWOW64\qedit.dll

Comments and Ratings (19)

Maks

Hi!
Who can give me compiled mexw32 files for this great avireader? Please

Maks

Same here: dxAviCloseMex crashes Matlab R2011a.

Joseph Tang

I am able to open avi file, but when I close it using dxAviCloseMex, it crashed Matlab. Any idea?

Works perfectly. Thanks for the note to change the .mexw32 extensions. This is going to save me so much time - Thank you!

Marta Mrak

Brad R

I'm seriously struggling to get this working. I'm using MATLAB 7.0.1 and it simply won't compile.

Aswin Bandaru

Thanks for the tool, saved a lot of time!

Ludovico Silvestri

Great! thanks! now I can save a lot of time!

Wesley Cheng

good! much better than mmread, thank you!

Mário Campos

Great job!!! Thanks!

R C

I can't get this to work. Even after renaming the mexw32 files to dll I get the following error:

??? Error using ==> run
One or more output arguments not assigned during call to "dxAviReadMex".

Dmitry Grishchenko

Great job. Thanks!!!

M V

Much better than mmread().
This one is stable and survives torture tests
(my movies have ~200000 frames...)

Tom Riley

I can now open large avi files. Great!

Yuan-Sen Yang

Great! Now I can read the DV avi files!

Aleksey Fadeev

Great job, works just fine, tried it with XVid codec using R14SP1.

Dustin Kruse

works beautifully

Updates

1.6.0.0

Uploaded newer files. Included link to dxAvi_64 provided by Jose Ignacio Gomez Espinola.

1.4.0.0

Newer source files were uploaded.

1.0.0.0

win64 info

MPlayerMex for Linux info

ffdshow configuration info

Fixed a couple of minor bugs.

MATLAB Release Compatibility
Created with R14SP3
Compatible with any release
Platform Compatibility
Windows macOS Linux