Not documented
The following code
fn = fullfile (tempdir(), "sombrero.mp4"); if (! exist (fn, "file")) warning ("'%s' doesn't exist, running demo VideoWriter first...", fn); demo ("VideoWriter"); endif x = VideoReader (fn); im = []; while (! isempty (img = readFrame (x))) if (isempty (im)) im = image (img); axis off; else set (im, "cdata", img); endif drawnow pause (1/30); endwhile
Produces the following figure
Figure 1 |
---|
The following code
r = VideoReader("https://raw.githubusercontent.com/opencv/opencv/master/samples/data/vtest.avi") im = []; while (r.hasFrame()) img = readFrame (r); if (isempty (im)) im = image (img); axis off; else set (im, "cdata", img); endif drawnow endwhile
Produces the following output
r = class VideoReader: Duration [s] = 79.50 BitsPerPixel = 24 Bitrate = 818283 FrameRate [fps] = 10.00 Height [px] = 576 Width [px] = 768 Name = vtest.avi Path = https://raw.githubusercontent.com/opencv/opencv/master/samples/data NumberOfFrames = 795 FrameNumber = 0 VideoFormat = RGB24 VideoCodec = msmpeg4v3 AspectRatio = [0 1]
and the following figure
Figure 1 |
---|
Package: video