IC Imaging Control .NET

MediaStreamSink

MediaStreamSink

The MediaStreamSink allows video files to be recorded in a more sophisticated manor than is possible using AviStartCapture and AviStopCapture. However, for simple tasks, the methods AviStartCapture and AviStopCapture are better suited, as they are really easy to use. A MediaStreamSink can save image data to video files in various formats and optionally allows you to specify one or more FrameFilters that can analyze and/or transform the image data, before it is written to the video file.

The FrameFilter implementation can also drop certain frames, thus enabling lapse recording applications to be easily authored. The video file format is specified by a MediaStreamContainer, while the format of the image data in the file is determined by a codec, represented as an AviCompressor object. The MediaStreamContainer determines the video file format; the most common MediaStreamContainer is AVI. Many media stream containers allow the specification of an AviCompressor to compress the image data before writing it to the file.

Example

The following code fragment shows how to create a MediaStreamSink to record an AVI file.

[C#]
// Create the MediaStreamSink. MediaStreamSink aviSink = new MediaStreamSink(); // We do not set aviSink.StreamContainer to record an AVI file, // as AVI is the default file format. // Set DV Video encoder as the codec. foreach( AviCompressor codec in ICImagingControl1.AviCompressors ) { if( codec.Name == "DV Video Encoder" ) { aviSink.Codec = codec; break; } } // Set a target file name. aviSink.Filename = "video.avi"; // Set the sink. ICImagingControl1.Sink = aviSink; // Start recording. ICImagingControl1.LiveStart();
[VB.NET]
' Create the MediaStreamSink. Dim aviSink As New MediaStreamSink ' We do not set aviSink.StreamContainer to record an AVI file, ' as AVI is the default file format. ' Set DV Video encoder as the codec. For Each codec As AviCompressor In IcImagingControl1.AviCompressors If codec.Name = "DV Video Encoder" Then aviSink.Codec = codec Exit For End If Next ' Set a target file name. aviSink.Filename = "video.avi" ' Set the sink. IcImagingControl1.Sink = aviSink ' Start recording. IcImagingControl1.LiveStart()

Information

Namespace: TIS.Imaging
Introduced in version 3.0

Inheritance

BaseSink
MediaStreamSink

Properties

Property Description
Codec

Returns or sets the used AviCompressor.

Filename

Returns or sets the name of the target video file.

FrameFilters

The FrameFilters property grants access to a FrameFilters collection that can be used to manipulate the filter chain used to transform the image data, before it is written to the video file.

StreamContainer

Returns or sets the used MediaStreamContainer.

Methods

Method Description
MediaStreamSink

Creates a new MediaStreamSink.

<< Classes

Get in touch with us


About The Imaging Source

Established in 1990, The Imaging Source is one of the leading manufacturers of industrial cameras, frame grabbers and video converters for production automation, quality assurance, logistics, medicine, science and security.

Our comprehensive range of cameras with USB 3.1, USB 3.0, USB 2.0, GigE interfaces and other innovative machine vision products are renowned for their high quality and ability to meet the performance requirements of demanding applications.

Automated Imaging Association ISO 9001:2015 certified

Contact us