필터 지우기
필터 지우기

VideoReader problem - Xvid video compression

조회 수: 11 (최근 30일)
Glen Lichtwark
Glen Lichtwark 2012년 1월 23일
댓글: Shawn Fernandes 2018년 3월 28일
I have a video which is compressed using the xvid video compressor. I am using the VideoReader function to open the file and am processing video frame by frame. Unfortunately, I have found that with the xvid compressed video every second frame is green. On doing some testing, I found that it isn't the actual frame in the file that is incorrect and it is something to do with reading the movie object. For instance, if I read the same frame consecutively, the first time I read it the image comes out as expected and the second time I read the same frame, the image comes out with all pixels green. Is this a bug in VideoReader? I am using a Mac operating system, but have tested this and found the same problem in both Windows 32 and 64 bit.
Details on the file are as follows -
General Settings:
Duration = 11.6117
Name = test.avi
Path = /Users/GL/Documents/Data
Tag =
Type = VideoReader
UserData = []
Video Settings:
BitsPerPixel = 24
FrameRate = 81.5559
Height = 544
NumberOfFrames = 947
VideoFormat = RGB24
Width = 768

답변 (1개)

Shawn Fernandes
Shawn Fernandes 2018년 3월 27일
Hi,
You would have to make use of the while loop with the 'hasFrame' and 'readFrame' option.
movie = VideoReader('test.avi');
i=1;
while hasFrame(movie)
video_data(i).cdata = readFrame(movie);
i=i+1;
end
Reference : https://www.mathworks.com/help/matlab/ref/videoreader.readframe.html
Tested on Matlab 2018a Windows 10.
Note: Installed ffdshow and x264 codecs separetely
https://sourceforge.net/projects/ffdshow-tryout/
https://sourceforge.net/projects/x264vfw/
  댓글 수: 2
Walter Roberson
Walter Roberson 2018년 3월 27일
Did you test with an xvid video specifically?
Note: back when the question was asked in 2012, readFrame() did not exist; it was added in R2014b.
Shawn Fernandes
Shawn Fernandes 2018년 3월 28일
Hi Walter,
This is the screenshot of the video file player when played on VLC player.
Thanks,

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Audio and Video Data에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by