Loading Videos without # of frames information
조회 수: 1 (최근 30일)
이전 댓글 표시
I have footage that I have downloaded from a site (<http://www.3dtv.at/movies/RhineValley_en.aspx>) and when loading in the multimedia reader I get the following warning:
>> mov = mmreader('Rhine Valley 576p.wmv');
Warning: Unable to determine the number of frames in this file.
I get around this by producing an estimate as follows:
>> est = mov.Duration*mov.FrameRate
est =
2.8151e+004
This should give me more frames then there are and assures that I get the whole.
However, due to the size, loading in the video as a whole will outdo my systems memory so I am trying to load them in as blocks and process them individually with my program (unrelated to my issues). So if I do the following:
>> mov1 = read(mov, [1 700]);
>> mov2 = read(mov, [700 1000]);
now if I use implay and look at the last frame of mov1, and look at the first frame mov2, they are not consecutive frames (presumably off by approx. 40 frames). Any ideas for whats causing the discrepancy?
댓글 수: 0
답변 (2개)
Arturo Moncada-Torres
2011년 5월 23일
Believe it or not, sometimes the frame rate of a video is not an integer number. For example, even though you may see from the video info that the frame rate is 29 frames/s, it is really something like 29.9 frames/s, which may generate a problem. Also, frame rate may not be constant because the quality of the camera, so every now and then it may "skip" a frame while recording (this does not affect the way we see it because of the nature of the human eye, but in frame by frame analysis it does have an effect).
Regarding the memory problem, I recommend you not to load all the frames in memory. Just load the number of frames and access to each frame using its "frame index". For example, if you want to display each frame as an image use:
imagesc(read(myVideo, frameIndex));
The same idea works if want to do some processing individually (which I think it is the case). Doing it this way, it solves the problems of frame skipping and memory overload ;-).
Hope it helps!
댓글 수: 0
Kipkomotkoita
2013년 8월 15일
convert the downloaded file using one of the converters such as YTD to XVid-mp4 (avi) format and its gonna work pretty well.
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!