MATLAB: How to send or receive audio and video content over a network

asfaudioComputer Vision ToolboxmmsNetworkstreamingvideowmawmv

I would like to use MATLAB (or Simulink) to send and receive a video stream over a network connection.

Best Answer

MATLAB and Simulink (R2010a) support network streaming via the Microsoft (R) MMS protocol (which is also known as the ASF, or Advanced Streaming Format, protocol). This ability is supported on Windows (R) operating systems: if you are using other operating systems, you should use UDP to transport your media streams.
This ability is provided by the Signal Processing Blockset (for audio data) or Video and Image Processing Blockset (for video data). If you are using Simulink, you should use the To Multimedia File and From Multimedia File blocks. If you are using MATLAB, you should use the MultimediaFileWriter and the MultimediaFileReader System objects (in either the signalblks or video packages).
Note that it is possible to encode and view these streams with other applications, to receive data from (and send data to) MATLAB/Simulink.
1. In order to view an MMS stream generated by MATLAB, you should use Internet Explorer, and provide the URL to the stream which you wish to read in the URL field (e.g. "mms://127.0.0.1:81").
2. If you wish to create an MMS stream which can be viewed by MATLAB, download the Windows Media Encoder or Microsoft Expression Encoder application, and configure it to produce a stream on a particular port (e.g. 81). Then, specify that URL in the Filename field of the MultimediaFileReader System object (or the From Multimedia File block).
Finally, note that the ability to send and receive network streams simultaneously is possible only when sending and receiving take place from separate processes (either separate instances of MATLAB or one MATLAB instance and a separated (compiled with Real-Time Workshop) executable).
Note: This example cannot be compiled using MATLAB Compiler as the Signal Processing Blockset is not supported by MATLAB Compiler.