我在matlab中有一个视频;我看过使用mmreader。文件信息是:
视频设置:
BitsPerPixel = 24
FrameRate = 25
Height = 288
NumberOfFrames = 590
VideoFormat = RGB24
Width = 352
在我的编码中,我想将帧速率更改为某个值。我怎么能这样做?
答案 0 :(得分:1)
您可以使用:
movie(M,n,fps)
以每秒fps帧的速度播放电影。默认值为每秒12帧。无法达到指定速度的计算机尽可能快地播放
或者,例如,请参阅此代码位(取自matlab文档)。特别是它的最后一行...
%Read and play back the movie file xylophone.mpg:
xyloObj = mmreader('xylophone.mpg');
nFrames = xyloObj.NumberOfFrames;
vidHeight = xyloObj.Height;
vidWidth = xyloObj.Width;
% Preallocate movie structure.
mov(1:nFrames) = ...
struct('cdata', zeros(vidHeight, vidWidth, 3, 'uint8'),...
'colormap', []);
% Read one frame at a time.
for k = 1 : nFrames
mov(k).cdata = read(xyloObj, k);
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);