| Video and Image Processing Blockset™ | |
View video from MATLAB workspace, multimedia file, or Simulink model
mplay
mplay('filename.avi')
mplay('filename.avi',fps)
mplay(a)
mplay(a,fps)
mplay({line_handles})
mplay({'block',port})
Use the MPlay GUI to view video from files or the MATLAB workspace. You can also use it to view video signals in Simulink models. If the video contains audio, the GUI ignores it and plays only the video frames. In the model window, you can access this GUI by selecting Tools > MPlay Video Viewer.
mplay opens an MPlay GUI.
mplay('filename.avi') connects the MPlay GUI to the specified AVI file.
mplay('filename.avi',fps) connects the MPlay GUI to the specified AVI file with the specified frame rate in frames per second, fps. By default, fps is the same as the frame rate specified in the file.
mplay(a) connects the MPlay GUI to the variable in the MATLAB workspace, a. The variable, a, must have one of the following formats:
MATLAB movie structure
Intensity movie array (M-by-N-by-T array, where the size of each image is M-by-N and there are T image frames).
RGB movie array (M-by-N-by-3-by-T array, where the size of each RGB image is M-by-N-by-3 and there are T image frames).
mplay(a,fps) connects the MPlay GUI to the variable in the MATLAB workspace, a, with the specified frame rate in frames per second, fps. By default, fps is 20.
mplay({line_handles}) connects the MPlay GUI to one or more Simulink signals to display. To get the handles to the Simulink signals, line_handles, issue the command mplay({gsl}).
mplay({'block',port}) connects the MPlay GUI to the signal output from the specified block, 'block', on output port index port. To get the full block path name of the current Simulink block, issue the command mplay({gcb,1}). If omitted, port is set to 1.
Note mplay only works when the Simulink simulation mode is set to Normal. It does not work when you use Acceleration Modes. |

This reference page contains the following sections:
You can open several instances of the MPlay GUI simultaneously to view multiple video data sources at once. You can also dock these MPlay GUIs in the MATLAB desktop. Use the figure arrangement buttons in the upper-right corner of the Sinks window to control the placement of the docked GUIs.
For more information about the MPlay GUI, see Viewing Videos from the MATLAB® Workspace, Viewing Video Files, and Viewing Video Signals in Simulink® in the Video and Image Processing Blockset User's Guide. You can also see the MPlay Simulink Tutorial in the Video Playback section of the Video and Image Processing Blockset demos.
MPlay GUI Buttons
| Button | Menu Equivalent | Shortcut Keys and Accelerators | Description |
|---|---|---|---|
|
| File > New MPlay | Ctrl+N | Open a new MPlay GUI. |
|
| File > Open | Ctrl+O | Connect to a video file. |
|
| File > Import from Workspace | Ctrl+I | Connect to a video that is a variable in the MATLAB workspace. |
|
| File > Connect to Simulink Signal | Ctrl+S | Connect to a Simulink signal. |
|
| File > Export to Image Tool | Ctrl+E | Send the current video frame to the Image Tool. For more information, see Using the Image Tool to Explore Images in the Image Processing Toolbox documentation. |
|
| Tools > Video Information | V | View information about the video data source. |
|
| Tools > Pixel Region | N/A | Open the Pixel Region tool. For more information about this tool, see the Image Processing Toolbox documentation. |
|
| Tools > Zoom In | N/A | Zoom in on the video display. |
|
| Tools > Zoom Out | N/A | Zoom out of the video display. |
|
| Tools > Pan | N/A | Move the image displayed in the GUI. |
|
| Tools > Maintain Fit to Window | N/A | Scale video to fit GUI size automatically. Toggle the button on or off. |
|
| N/A | N/A | Enlarge or shrink the video. This option is available if the Maintain Fit to Window button is not selected. |
For workspace and file sources: | |||
|
| Playback > Go to First | F, Home | Go to the first frame of the video. |
|
| Playback > Rewind | Up arrow | Jump back 10 frames. |
|
| Playback > Step Back | Left arrow, Page Up | Step back one frame. |
|
| Playback > Stop | S | Stop the video. |
|
| Playback > Play | P, Space bar | Play the video. |
|
| Playback > Pause | P, Space bar | Pause the video. This button is visible only when the video is playing. |
|
| Playback > Step Forward | Right arrow, Page Down | Step forward one frame. |
|
| Playback > Fast Forward | Down arrow | Jump forward 10 frames. |
|
| Playback > Go to Last | L, End | Go to the last frame of the video. |
|
| Playback > Jump to | J | Jump to a specific frame. |
|
| Playback > Playback Modes > Repeat | R | Repeated video playback. |
|
| Playback > Playback Modes > Forward play | A | Play the video forward. |
|
| Playback > Playback Modes > Backwardplay | A | Play the video backward. |
|
| Playback > Playback Modes > AutoReverse play | A | Play the video forward and backward. |
For Simulink sources: | |||
|
| Playback > Stop | S | Stop the video. This button also controls the Simulink model. |
|
| Playback > Start | P, Space bar | Play the video. This button also controls the Simulink model. |
|
| Playback > Pause | P, Space bar | Pause the video. This button also controls the Simulink model and is visible only when the video is playing. |
|
| Playback > Step Forward | Right arrow, Page Down | Step forward one frame. This button also controls the Simulink model. |
|
| Playback > Simulink Snapshot | N/A | Click this button to freeze the display in the MPlay window. |
|
| Playback > Highlight Simulink Signal | Ctrl+L | In the model window, highlight the Simulink signal the MPlay GUI is displaying. |
|
| Playback > Floating Signal Connection (not selected) | N/A | Indicates persistent Simulink connection. In this mode, the MPlay GUI is always associated with the Simulink signal you selected before you clicked the Connect to Simulink Signal button. |
|
| Playback > Floating Signal Connection (selected) | N/A | Indicates floating Simulink connection. In this mode, you can click different signals in the model, and the MPlay GUI displays them. Only one MPlay GUI can be in floating-scope mode at one time. |
The MPlay Configuration dialog box enables you to change the behavior and appearance of the GUI as well as the behavior of the playback shortcut keys.
To open the Configuration dialog box, select File > Configuration Set > Edit.
To save the configuration settings for future use, select File > Configuration Set > Save as.
To load a preexisting configuration set, select File > Configuration Set > Load.
The Core pane controls the GUI's general and source settings.

Click General UI, and click the Options button to open the General UI Options dialog box.

If you select the Display the full source path in the title bar check box, the GUI displays the full path to the video data source in the title bar. Otherwise, it displays a shortened name.
Use the Message log opens when parameter to control when the Message log window opens. You can use this window to debug issues with video playback. Your choices are for any new messages, for warn/fail messages, only for fail messages, or manually.
Click Source UI and click the Options button to open the Source UI Options dialog box.

If you select the Keyboard commands respect playback mode check box, the keyboard shortcut keys are aware of whether or not you selected Repeat, Forward play, Backward play, or Fwd/Back play for the playback mode. If you clear this check box, the keyboard shortcut keys behave as if the playback mode is set to Forward play and Repeat is set to off.
Use the Recently used sources list parameter to control the number of sources you see in the File menu.
The Sources pane contains the GUI options that relate to connecting to different sources. Select the Enabled check box next to each source type to specify to which type of source you want to connect the GUI.

Click File, and click the Options button to open the File Options dialog box.

Use the Recently opened file path parameter to control the directory that is displayed in the Connect to File dialog box when you click File > Open.
Click Simulink, and click the Options button to open the Simulink Options dialog box.

Select the Load Simulink model if not open check box if you want the Simulink model associated with an MPlay GUI to open when you open the GUI.
The Tools pane contains the tools that are available on the MPlay GUI. Select the Enabled check box next to the tool name to specify which tools to include on the GUI.

Click Image Tool, and click the Options button to open the Image Tool Options dialog box.

Select the Open new Image Tool window for export check box if you want to send each video frame to a different session of Image Tool.
The Video Information dialog box lets you view basic information
about the video. To open this dialog box, click Tools
> Video Information or click
.

The Colormap dialog box lets you change the colormap of an intensity video. The parameters on this dialog box are not available when the GUI is displaying RGB video data. To open this dialog box, click Tools > Colormap or press C.

Use the Colormap parameter to specify the colormap to apply to the intensity video.
If you know that the pixel values do not use the entire data type range, you can select the Specify range of displayed pixel values check box and enter the range for your data. The dialog box automatically displays the range based on the data type of the pixel values.
The Frame Rate dialog box displays the frame rate of the source, lets you change the rate at which the MPlay GUI plays the video, and displays the actual playback rate.
Note This dialog box is not available if you are using the MPlay GUI to view a video signal in a Simulink model. |
The playback rate is the number of frames the GUI processes per second. You can use the Desired playback rate parameter to decrease or increase the playback rate. To open this dialog box, click Playback > Frame Rate or press T.

If you want to increase the actual playback rate, but your system's hardware cannot keep up with the desired rate, select the Allow frame drop to achieve desired playback rate check box as shown in the following figure. This parameter enables the MPlay GUI to achieve the playback rate by dropping video frames. As a result, the video playback might appear choppy.

For example, suppose you set the Desired playback rate to 150 frames/sec. The MPlay GUI can achieve this desired playback rate by setting the Playback schedule to Show 1 frame, Drop 5 frames, which results in a frame size of 6. It also sets the Refresh rate, or how often the GUI updates the screen, to 25 frames/sec. If you multiply the refresh rate (25 frames/sec) by the frame size (6), you see that the GUI can achieve the Desired playback rate (150 frames/sec) by using these parameter values.
You can use the Minimum refresh rate and Maximum refresh rate parameters to adjust the playback schedule of the video displayed in the GUI in the following ways:
Increase the Minimum refresh rate parameter to achieve smoother playback.
Decrease the Maximum refresh rate parameter to reduce the demand on your system's hardware.
The MPlay GUI enables you to save and load the settings of multiple GUI instances. That way, you only need to configure the MPlay GUIs that are associated with your model once. To save the GUI settings, click File > Instrumentation Sets > Save Set. To open the preconfigured MPlay GUIs, click File > Instrumentation Sets > Load Set.
The Message Log provides a system level record of MPlay configurations and settings. You can filter what messages to display by Type and Category, view the records, and display record details.
The Type parameter allows you to select either All, Info, Warn or Fail message logs. The Category parameter allows you to select either Configuration or Extension message summaries. The Configuration messages indicate when a new configuration file is loaded. The Extension messages indicate a component is registered. For example, you might see a Simulink message, which indicates it is registered and available for configuration.
Along the bottom of the MPlay viewer is the status bar. It displays information, such as video status, Type of video playing (I or RGB), Frame size, Percentage of frame rate, Frame rate, and Current frame: Total frames.
Note A minus sign for Current frame indicates that the video is being played backwards |
Video and Image Processing Blockset | |
Video and Image Processing Blockset | |
Video and Image Processing Blockset | |
Video and Image Processing Blockset |
![]() | isfilterseparable |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |