Main Content


Play video or display image


Play a video or display image sequences.


If you own the MATLAB® Coder™ product, you can generate C or C++ code from MATLAB code in which an instance of this system object is created. When you do so, the scope system object is automatically declared as an extrinsic variable. In this manner, you are able to see the scope display in the same way that you would see a figure using the plot function, without directly generating code from it. For the full list of system objects supporting code generation, see Code Generation Support, Usage Notes, and Limitations.




videoPlayer = vision.VideoPlayer returns a video player object, videoPlayer, for displaying video frames.

videoPlayer = vision.VideoPlayer(___,Name,Value) specifies properties using one or more name-value arguments in addition to the previous syntax. For example, videoPlayer = vision.VideoPlayer('Name','Caption title') sets the caption display on the video player window.


expand all

Caption display on video player window, specified as a character vector.

Tunable: Yes

Size and position of the video player window in pixels, specified as a four-element vector, [left bottom width height]. The default size depends on your screen resolution. The window is positioned in the center of the screen, 400 pixels in width by 300 pixels in height.

Tunable: Yes



videoPlayer(videoFrame) displays one grayscale or truecolor RGB video frame,videoFrame, in the video player.

Input Arguments

expand all

Video frame, specified as a truecolor or 2-D grayscale image.

Object Functions

To use an object function, specify the System object™ as the first input argument. For example, to release system resources of a System object named obj, use this syntax:


expand all

stepRun System object algorithm
releaseRelease resources and allow changes to System object property values and input characteristics
resetReset internal states of System object


collapse all

Read video from a file and set up player object.

videoReader = VideoReader('viplanedeparture.mp4');
videoPlayer = vision.VideoPlayer;

Play video.

while hasFrame(videoReader)
   frame = readFrame(videoReader);

Close the video player.


Version History

Introduced in R2012a