how to read compressed avi

I am working on some video gamma correction. And I used some sample avi uncompressed clips from online, everything works just fine. But once I try to use our own .avi video 1280x800 20 second about 400mb, Matlab can not read file through 'VideoReader'.
I'm really sure the problem is that my video is compressed avi. And I have tried the following to solve it:
1. some say in mac os, download gstreamer 0.10 may help. I did, but problem remained.
2. i tried to use ffmpeg to convert the compressed avi to uncompressed avi (i dont think i am supposed to do this tho). but the new uncompressed video became a mess.
So, I was thinking, when working on compressed avi file in MATLAB on mac, is there a good routine that people follow?
Thanks a lot.

6 commentaires

Tamir Suliman
Tamir Suliman le 3 Déc 2016
what is the error that matlab throwing when it cant read the file ?
JL peng
JL peng le 4 Déc 2016
Error using VideoReader/init (line 619) Failed to initialize internal resources.
Error in VideoReader (line 172) obj.init(fileName);
Thanks for replying. The uncompressed video is a 5.8mb file called 'suzie.avi' from online. Actually I also tried to cut my own video into smaller piece (~60mb) in case the workload is too large for my RAM(8GB), but it didn't work.
Tamir Suliman
Tamir Suliman le 4 Déc 2016
can you pelase post the code and share the video to test ?
JL peng
JL peng le 5 Déc 2016
Hi, I just simply used:
v = VideoReader('test.avi');
the uncompressed avi which works is from:
and the compressed avi which can not be processed is large, i found someplace with sample compressed avi as followed(I tried 'bird.avi' from this website to confirm it doesn't work):
thanks again.
Mat Lab
Mat Lab le 6 Déc 2016
forgot to mention, the codec for my avi is huffyuv
Mat Lab
Mat Lab le 6 Déc 2016
Solution found:
used :
ffmpeg -i test.avi -f image2 %04d.bmp
to extract all frame in bmp
then used:
ffmpeg -framerate 30 -pattern_type glob -i '*.bmp' -c:v rawvideo test_raw.avi
to generate the raw avi file. then video is nice and smooth, and can be read by Matlab's 'VideoReader' command.

Connectez-vous pour commenter.

Réponses (1)

AILEEN SENGUPTA
AILEEN SENGUPTA le 18 Avr 2019

0 votes

Hi,
I had two basic queries:
1. You have converted the compressed AVI into raw avi file to be read into matlab, so tis is not the same as uncompressed avi? why a raw format?
2. If we take a raw YUV video and convert it into a raw avi, does the video incur a loss? of course when we are reading the video sequence into matlab we will use the Y componen only: Strip to channel Y: frame1 = frame1(:,:,1); and then repeat it for all frames
Thanks,
Aileen

Community Treasure Hunt

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

Start Hunting!

Translated by