VideoReader problem - Xvid video compression
7 ビュー (過去 30 日間)
古いコメントを表示
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
0 件のコメント
回答 (1 件)
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
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
2018 年 3 月 28 日
Hi Walter,
This is the screenshot of the video file player when played on VLC player.
Thanks,
参考
カテゴリ
Help Center および File Exchange で Audio and Video Data についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!