: p = VideoWriter ()

Create object p of the VideoWriter class.

: VideoWriter.open

Just checks if the file can be created, no need to call this before ’writeVideo’ in this implementation.

: VideoWriter.writeVideo

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.

: __octave_video_set_verbosity_level__ (LEVEL)

Internal function to increase chattiness of the underlying code for debugging purposes.

  • 0: only errors
  • 1: + warnings (default)
  • 2: + info messages
  • 3: + verbose info messages
  • 4: + ffmpeg debug messages

Demonstration 1

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