我在 matlab 中有一个视频;我使用 mmreader 阅读。文件信息为:
视频设置:
BitsPerPixel = 24
FrameRate = 25
Height = 288
NumberOfFrames = 590
VideoFormat = RGB24
Width = 352
在我的编码中,我想将帧速率更改为某个值。我怎样才能做到这一点?
您可以使用 :
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);