MPlatform SDK: Writer sample

The Writer Sample is a demo for MWriter object. It illustrates how to capture a live source to the file or stream it to the network.

Below you can view a video explaining how to configure the live source and input/output stream properties, set up a preview, etc.:

Key Features

  • Live source video capture and network streaming with format conversion
  • Delay or live source time shifting
  • Advanced audio and video codecs management
  • Closed captions capturing to file
  • Preview control with deinterlacing

User guide

The Writer sample illustrates the use of MControls library to create a capture application.

To start capturing you need to:

  1. Select a source device.
  2. Initialize the device.
  3. Select a container format.
  4. Select audio and video codecs.
  5. Start to capture.

First, let’s look at the Device Settings panel, where you will find all of the properties for devices:

  1. MPlatform has an option to get a stream from any Source object (e.g MPlaylist, MFile, MMixer, etc.) that is currently active. It doesn't depend on which application Source object is working in. This logic is implemented in Extern Sink list. E.g. you can have MPlaylist runnning and obtain signal from it by selecting MPlaylist in Extern Sink
  2. You can set any properties for your audio or video devices and set its input format in Properties menu. To open this menu click Props button.
  3. To initialize the device you should click Init Device button. You'll get image from the device in the preview window.
  4. To select a different device click Close Device button. Select a new video or audio device and click Init Device again.

As a part of Device settings you have and option to select Delay enabled if you want to time shift your live source:
  • Choose the amount in seconds. Note, that you have an option of Preview type to be delayed or live.
  • Use a slider to seek thru the timeshifted stream.
  • For more information, please consult our documentation at MDelay.

Format controls enable you to set format of audio and video select the required format in Video and Audio lists. Note, that if you want to capture file in a format that is different from your incoming format, you can choose before starting capturing.

Now, let’s take a look at Writer’s configuration panel:

1. To set the container format and audio and video codecs click the cell in every row and select the required property (e.g. format, audio and video). Note, that a list of encoders will differ depending on the type of container selected.

You can choose and configure container for streaming (select appropriate audio and video encoders) and type in streaming URL.  It will work the same way as capturing file.

2. To configure additional parameters for formats and codecs you should double click on "format", "format::video" and "format::audio" cells to open attributes menu.

Next are the Capture control buttons:

  • To start the capturing click Start Capture button.
  • To pause capturing click Pause Capture button. You can select the duration of a pause in seconds.
  • Click Stop Capture button to stop the capturing.

Preview panel has the following configurations:

  • To enable or disable Video/Audio preview put a check mark.
  • To control the volume for Audio preview use a slider.
  • To adjust preview while maintaining aspect ratio check mark AR box.
  • Use a Fullscreen option if necessary.
  • To deinterlace your preview check mark Deinterlace box. Note, that it only affects the preview while the output is still interlaced. Useful when you need a high quality preview.

Note, that changes to the Audio and AR influence preview only, not the output stream.

There are two additional checkboxes below the Preview panel:

  • If you want to add Character Generator elements (such as images, text and graphics) to your stream, check CG Enabled box and click CG Props button to setup Character Generator properties.
  • Check mark Virtual Source box to enable the output of the sample to be available in the system as a DirectShow source filter, which makes it possible to use this stream with third-party applications such as the Flash Media Live Encoder. The name of the source in the list will be "Medialooks MLive Video".

Finally, you can monitor capture session’s statistics in the Writer’s status window.