Using writeVideo command & result...
175 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Julia
am 17 Sep. 2014
Beantwortet: Geoff Hayes
am 17 Sep. 2014
I am using the writeVideo command and while it successfully makes the .avi file, when I play it outside of matlab it plays very fast. Is this a problem with my script or something else?
script here:
vidObj = VideoWriter('pr_lgm_r1_ccsm4.avi');
open(vidObj);
for i=1:12
X=squeeze(pr(:,:,i));
figure
contourf(lon,lat,X','LineStyle','none')
pause(1.0); %slow down frames
% Write each frame to the file.
currFrame = getframe(gcf);
writeVideo(vidObj,currFrame);
cla;
end
% Close the file.
close(vidObj);
Any advice appreciated
0 Kommentare
Akzeptierte Antwort
Geoff Hayes
am 17 Sep. 2014
Julia - the default frame rate for the VideoWriter object is 30 frames per second (see VideoWriter class for details).
I noticed that you put a one second pause in your for loop. If you want only one frame to appear per second, then you just need to set this rate in vidObj
vidObj = VideoWriter('pr_lgm_r1_ccsm4.avi');
vidObj.FrameRate = 1;
open(vidObj);
Try the above and see what happens!
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Audio and Video Data finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!