Can't get video's number of frames before processing?
1 次查看(过去 30 天)
显示 更早的评论
I used videoReader--> read but i get "[]" in the number of frames field. i have tried using vision.VideoFileReader but it gives a less informative header ( without that kind of information)
I need the frame number BEFORE processing , not after. I am uploading the video so you could try yourselves
0 个评论
采纳的回答
Dinesh Iyer
2014-7-29
Hi Lirian,
The vision.VideoFileReader system object allows reading only one frame at a time and does not allow random access.
I tried to open this file using Windows Media Player but was unable to do so. I believe I need some additional codecs as you mentioned.
Can you try to force VideoReader to read the last frame as below
if true
vidObj = VideoReader('swipeCut.mp4');
read(vidObj, Inf);
vidObj.NumberOfFrames
end
This should display the last frame read. However, this operation might take time depending upon the size of the video.
I am curious however as to why you need the total number of frames?
Hope this helps.
Dinesh
3 个评论
PRUDHVI RAJU
2016-4-21
编辑:Walter Roberson
2016-4-21
%
% Read Video
video = VideoReader('fp.avi');
%video = VideoReader('sv.mp4');
%no.of frames
nframes=video.NumberOfFrames;
更多回答(1 个)
Dima Lisin
2014-7-28
Thre maybe something wrong with the header of your video file. Can you try VideoReader on a different file?
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!