Import from Video Files

In this example, you use the From Multimedia File source block to import a video stream into a Simulink® model and the To Video Display sink block to view it. This procedure assumes you are working on a Windows platform.

You can open the example model by typing at the MATLAB®command line.

  1. Run your model.

  2. View your video in the To Video Display window that automatically appears when you start your simulation.

You have now imported and displayed a multimedia file in the Simulink model. In the Export to Video Files example you can manipulate your video stream and export it to a multimedia file.

For more information on the blocks used in this example, see the From Multimedia File and To Video Display block reference pages.

Setting Block Parameters for this Example

The block parameters in this example were modified from default values as follows:

From Multimedia File

Use the From Multimedia File block to import the multimedia file into the model:

  • If you do not have your own multimedia file, use the default vipmen.avi file, for the File name parameter.

  • If the multimedia file is on your MATLAB path, enter the filename for the File name parameter.

  • If the file is not on your MATLAB path, use the Browse button to locate the multimedia file.

  • Set the Image signal parameter to Separate color signals.

By default, the Number of times to play file parameter is set to inf. The model continues to play the file until the simulation stops.

To Video Display

Use the To Video Display block to view the multimedia file.

  • Image signal: Separate color signals

Set this parameter from the Settings menu of the display viewer.

Configuration Parameters

You can locate the Model Configuration Parameters by selecting Model Configuration Parameters from the Simulation menu. For this example, the parameters on the Solver pane, are set as follows:

  • Stop time = 20

  • Type = Fixed-step

  • Solver = Discrete (no continuous states)