Create object p of the VideoWriter class.
Just checks if the file can be created, no need to call this before ’writeVideo’ in this implementation.
This ultimately creates the video file with previously set params. Width and height of the first frame given determines the width and height of the video.
Internal function to increase chattiness of the underlying code for debugging purposes.
The following code
fn = fullfile (tempdir (), "sombrero.mp4"); w = VideoWriter (fn); w.FrameRate = 50; open (w); z = sombrero (); hs = surf (z); axis manual nframes = 200; for ii = 1:nframes set (hs, "zdata", z * sin (2*pi*ii/nframes + pi/5)); drawnow writeVideo (w, getframe (gcf)); endfor close (w) printf ("Now run 'open %s' to read the video with your default video player or try 'demo VideoReader'!\n", fn);
Produces the following output
Now run 'open /tmp/sombrero.mp4' to read the video with your default video player or try 'demo VideoReader'!
and the following figure
Figure 1 |
---|
Package: video