필터 지우기
필터 지우기

How to create one .avi-video from a folder with i.png files?

조회 수: 12 (최근 30일)
Emerson De Souza
Emerson De Souza 2012년 12월 1일
댓글: Walter Roberson 2021년 8월 16일
Hi, I have a folder with 20000 .png files named 1.png, 2.png, and so on until 20000. I would like to make a .avi-video of it. The size of the entire folder is about 90MB. I read the documentation about the video writer but it did not address this specific problem.
I wonder if someone could help or suggest me which commands to load and and make the .png to a video file.
I thank you in advance for your help
Emerson

채택된 답변

Walter Roberson
Walter Roberson 2012년 12월 1일
writerObj = VideoWriter('YourAVI.avi');
open(writerObj);
for K = 1 : 20000
filename = sprintf('%d.png', K);
thisimage = imread(filename);
writeVideo(writerObj, thisimage);
end
close(writerObj);
  댓글 수: 4
Joydeb Saha
Joydeb Saha 2021년 8월 16일
I had the same problem and I used the Emerson's code. But how can I save the video? I just used the code that Emerson gave as an attachment.
Walter Roberson
Walter Roberson 2021년 8월 16일
Parts of the video may be written as you go, but there are internal buffers, so you should not rely upon frames being written as soon as you do the writeVideo() call. However, any buffered frames will be finalized and written when you close() the object.
Make sure that the name you gave in the VideoWriter() is the name of a file (with directory preferred) that you have write access to.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by