How can I use the MMREADER function to properly read DIVX coded AVI files in MATLAB 7.5 (R2007b)?

5 views (last 30 days)
When I execute the following code:
filename = 'seq3.avi';%video file encoded with DivX 5.0
avi_obj=mmreader(filename);
no_frame=get(avi_obj,'NumberOfFrames');
figure
for i=1:no_frame
img=read(avi_obj,i);
imshow(img),title(sprintf('Frame %d',i));
drawnow; pause(0.5);
end
I got a garbled image.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 17 Jun 2021
Edited: MathWorks Support Team on 21 Jun 2021
The problem of garbled image display is related to the codec being employed. MATLAB does not have control over which codec is used for the decoding. We simply let windows choose the most appropriate codec for us.
DivX® 5.0 Codec causes users to see garbled images when loading AVI files in MATLAB using MMREADER function. There are several fixes and updates to DivX® Codecs and it is important to install the latest codec to prevent undesirable results. The latest updates of this third party codec can be found at:
Since we do not have a control on which codec is being employed, it is also important to make sure that the previous versions of DivX® Codecs are completely uninstalled and removed from the system and registry. This ensures that the older versions are not called.
The AVIREAD function can be employed instead of MMREADER as a possible work-around:
filename = 'seq3.avi'; avi_obj=aviread(filename); no_frame=size(avi_obj,2); figure for i=721:no_frame img=avi_obj(i).cdata; imshow(img),title(sprintf('Frame %d',i)); drawnow; pause(0.5); end

More Answers (0)

Categories

Find more on Get Started with MATLAB in Help Center and File Exchange

Products


Release

R2007b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!