how to read compressed avi

3 views (last 30 days)
JL peng
JL peng on 3 Dec 2016
Answered: AILEEN SENGUPTA on 18 Apr 2019
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 Comments
Mat Lab
Mat Lab on 6 Dec 2016
forgot to mention, the codec for my avi is huffyuv
Mat Lab
Mat Lab on 6 Dec 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.

Sign in to comment.

Answers (1)

AILEEN SENGUPTA
AILEEN SENGUPTA on 18 Apr 2019
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!