mplay

View video from MATLAB workspace, multimedia file, or Simulink model

Syntax

mplay
mplay('filename.avi')
mplay('filename.avi',fps)
mplay(a)
mplay(a,fps)
mplay({line_handles})
mplay({'block',port})

Description

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:

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.

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

ButtonMenu EquivalentShortcut Keys and AcceleratorsDescription
File > New MPlayCtrl+NOpen a new MPlay GUI.
File > OpenCtrl+OConnect to a video file.
File > Import from WorkspaceCtrl+IConnect to a video that is a variable in the MATLAB workspace.
File > Connect to Simulink SignalCtrl+SConnect to a Simulink signal.
File > Export to Image ToolCtrl+ESend 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.

    Note   The Image Tool only knows the frame is an intensity image if the colormap of the frame is grayscale (gray(256)). Otherwise, the Image Tool assumes the frame is an indexed image and disables the Adjust Contrast button.

Tools > Video InformationVView information about the video data source.
Tools > Pixel RegionN/AOpen the Pixel Region tool. For more information about this tool, see the Image Processing Toolbox documentation.
Tools > Zoom InN/AZoom in on the video display.
Tools > Zoom OutN/AZoom out of the video display.
Tools > PanN/AMove the image displayed in the GUI.
Tools > Maintain Fit to WindowN/AScale video to fit GUI size automatically. Toggle the button on or off.
N/AN/AEnlarge 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 FirstF, HomeGo to the first frame of the video.
Playback > RewindUp arrowJump back 10 frames.
Playback > Step BackLeft arrow, Page UpStep back one frame.
Playback > StopSStop the video.
Playback > PlayP, Space barPlay the video.
Playback > PauseP, Space barPause the video. This button is visible only when the video is playing.
Playback > Step ForwardRight arrow, Page DownStep forward one frame.
Playback > Fast ForwardDown arrowJump forward 10 frames.
Playback > Go to LastL, EndGo to the last frame of the video.
Playback > Jump toJJump to a specific frame.
Playback > Playback Modes > RepeatRRepeated video playback.
Playback > Playback Modes > Forward playAPlay the video forward.
Playback > Playback Modes > BackwardplayAPlay the video backward.
Playback > Playback Modes > AutoReverse playAPlay the video forward and backward.

For Simulink sources:

  
Playback > StopSStop the video. This button also controls the Simulink model.
Playback > StartP, Space barPlay the video. This button also controls the Simulink model.
Playback > PauseP, Space barPause the video. This button also controls the Simulink model and is visible only when the video is playing.
Playback > Step ForwardRight arrow, Page DownStep forward one frame. This button also controls the Simulink model.
Playback > Simulink SnapshotN/AClick this button to freeze the display in the MPlay window.
Playback > Highlight Simulink SignalCtrl+LIn the model window, highlight the Simulink signal the MPlay GUI is displaying.
Playback > Floating Signal Connection (not selected)N/AIndicates 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/AIndicates 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.

MPlay Configuration Dialog Box

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.

Core Pane

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.

Sources Pane

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.

Tools Pane

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.

Video Information Dialog Box

The Video Information dialog box lets you view basic information about the video. To open this dialog box, click Tools > Video Information or click .

Colormap Dialog Box

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.

Frame Rate Dialog Box

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.

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:

Saving the Settings of Multiple MPlay GUIs

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.

Message Log Dialog Box

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.

Status Bar

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.

See Also

To Multimedia File

Video and Image Processing Blockset

To Video Display

Video and Image Processing Blockset

Video To Workspace

Video and Image Processing Blockset

Video Viewer

Video and Image Processing Blockset

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS