我想编写一个程序来分割选定长度的电影。以下是我的代码。
movieFullFileName = '001.mp4';
videoObject = VideoReader(movieFullFileName);
% Determine how many frames there are.
numberOfFrames = videoObject.NumberOfFrames;
vidHeight = videoObject.Height;
vidWidth = videoObject.Width;
% Create a VideoWriter object to write the video out to a new, different file.
writerObj = VideoWriter('new001.mp4', 'MPEG-4');
open(writerObj);
for frame = 1 : 1000
% Extract the frame from the movie structure.
thisFrame = read(videoObject, frame);
writeVideo(writerObj, thisFrame);
end
close(writerObj);
问题是它会重新格式化电影,但我想要的只是分割电影然后直接输出。如何用Matlab做到?