Matlab2012a 获取视频文件的总帧数
帮助文档中的例子:
xyloObj = VideoReader('Building.avi');
nFrames = xyloObj.NumberOfFrames;
vidHeight = xyloObj.Height;
vidWidth = xyloObj.Width;
% Preallocate movie structure.
mov(1:nFrames) = ...
% Read one frame at a time.
for k = 1 : nFrames
end
% Size a figure based on the video's width and height.
hf = figure;
set(hf, 'position', [150 150 vidWidth vidHeight])
% Play back the movie once at the video's frame rate.
movie(hf, mov, 1, xyloObj.FrameRate);
运行结果:
无法确定该文件的帧的数目。
Help:
MATLAB -> User's Guide -> Data Import and Export -> Importing Data ->
Importing Audio and Video ->
Read Video Files ->
Reading Variable Frame Rate Video -> Counting Frames