Change frame rate of video file
308 次查看(过去 30 天)
显示 更早的评论
I have a video file but videoReader doesn't allow frame rate change. I think i have to rewrite each of the frames in a loop to change the rate but don't know how to do that. if anyone has any suggestions thanks in advance
0 个评论
回答(2 个)
Stephan
2021-5-10
编辑:Stephan
2021-5-10
You are fully right. First read all the frames using the read command for VideoReader. Then make a VideoWriter object and use the FrameRate property to set the frame rate you need and then write the video file using writeVideo. If you read the documentation and follow the examples given there it is quite easy to do this.
Aditya Desai
2024-5-28
If you're asking for how to do it in code, here is an example:
v = VideoWriter('testMiniPlayer','MPEG-4');
v.FrameRate = 10;
open(v)
for i = 1:length(vid)
writeVideo(v,vid(i))
end
close(v)
Where vid is an array of the plots I want in my video. In mine, I used getframe(gcf) at each frame
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!