Why do I receive an error when I use AVIREAD to read a MJPG compressed AVI file?

2 views (last 30 days)
When I try to read a MJPG compressed AVI file using AVIREAD, I receive the following error:
ERROR: ??? Unable to locate decompressor to decompress video stream
Error in ==> C:\Apps\matlab6p1\toolbox\matlab\iofun\private\readavi.dll
Error in ==> C:\Apps\matlab6p1\toolbox\matlab\iofun\aviread.m
On line 61 ==> X = readavi(filename,-1);

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 20 Apr 2022
Edited: MathWorks Support Team on 25 May 2022
The following documentation describes how a vision.VideoFileReader object can be used to read MJPG compressed AVI files.
Read video frames and audio samples from video file - 
For previous product releases, read below for any possible workarounds:
MATLAB is not able to read MJPG compressed AVI files using the AVIREAD function.
The file cannot be decompressed since it is compressed using MJPG. Since the codecs used to compress the video are DirectShow compatible, AVIREAD will not be able to decompress this video, since AVIREAD uses Video For Windows (VFW), which is an earlier technology than DirectShow.
Some customers have reported limited success with the following possible workarounds:
1. There is a commercially available version of an MJPG decompressor that works with the older VFW technology used by AVIREAD. A free trial version of this codec can be downloaded here:
The full version of the decompressor requires purchasing it from Pegasus.
In some instances the colors may appear incorrect when using this decompressor. If you have run into this issue, then try swapping the R and B color plane using the following code:
m = aviread(filename);
for ii = 1:length(m)
m(ii).cdata = m(ii).cdata(:,:,[2 3 1]);
end
2. Another workaround is to convert the MJPG-file to an AVI-file using a conversion tool such as HandyAVI. The output movie is uncompressed, and MATLAB was able to read it. More information regarding this converter can be found at the following web address:

More Answers (0)

Tags

Products


Release

R2006a

Community Treasure Hunt

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

Start Hunting!