VideoWriter Class#
Inheritance Hierarchy#
System.Object
Basler.Pylon.VideoWriter
Syntax#
C#
VB
The VideoWriter type exposes the following members.
Constructors#
Name | Description | |
---|---|---|
VideoWriter | Initializes a new instance of the VideoWriter class. |
Properties#
Name | Description | |
---|---|---|
ImageDataBytesWritten | Returns the amount of image data written to the video file in bytes. | |
IsOpen | Returns the open state of the video file. | |
IsSupported | Checks if video writing is supported. | |
Parameters | Returns the parameter collection of the video writer for accessing all parameters. Example: videowriter.Parameters[PLVideoWriter.BytesWritten].GetValue(); |
Methods#
Name | Description | |
---|---|---|
CanWriteWithoutConversion(IImage) | Checks whether the image passed can be added to the video file without prior conversion. | |
CanWriteWithoutConversion(PixelType, Int32, Int32, Int32, ImageOrientation) | Checks whether the given data/image can be added to the video file without prior conversion. | |
Close | Closes the file. | |
Create(String, Double, ICamera) | Creates and opens a file for video writing. | |
Create(String, Double, PixelType, Int32, Int32) | Creates and opens a file for video writing. | |
Create(String, Double, PixelType, Int32, Int32, UInt32) | Creates and opens a file for video writing. | |
Dispose | Releases all resources used by the VideoWriter | |
Write(IImage) | Writes an image to the video. | |
Write(T)(T[], PixelType, Int32, Int32, Int32, ImageOrientation) | Writes the image to the video. |
VideoWriter.CanWriteWithoutConversion Method (IImage)#
Checks whether the image passed can be added to the video file without prior conversion.
Syntax#
C#
VB
Parameters#
- image
- Type: Basler.Pylon.IImage
Image or grabresult to check.
Return Value#
Type: Boolean
Returns true if the image will added to the video stream without prior conversion when Write() is called. Returns false if the image will be automatically converted when Write() is called. Returns false if the image cannot be added at all. See the preconditions of Write() for more information.
Implements#
IVideoWriter.CanWriteWithoutConversion(IImage)
Remarks#
Thread Safety: This method is thread-safe.
Error Safety: Does not throw exceptions.
VideoWriter.CanWriteWithoutConversion Method (PixelType, Int32, Int32, Int32, ImageOrientation)#
Checks whether the given data/image can be added to the video file without prior conversion.
Syntax#
C#
public virtual bool CanWriteWithoutConversion(
PixelType pixelType,
int width,
int height,
int paddingX,
ImageOrientation orientation
)
VB
Public Overridable Function CanWriteWithoutConversion (
pixelType As PixelType,
width As Integer,
height As Integer,
paddingX As Integer,
orientation As ImageOrientation
) As Boolean
Parameters#
- pixelType
- Type: Basler.Pylon.PixelType
The pixel type of the image. - width
- Type: System.Int32
Width of the image. - height
- Type: System.Int32
Height of the image. - paddingX
- Type: System.Int32
The number of extra data bytes at the end of each row. - orientation
- Type: Basler.Pylon.ImageOrientation
Orientation of the video. Most codecs support ImageOrientation.BottomUp only.
Return Value#
Type: Boolean
Returns true if the image will added to the video stream without prior conversion when Write() is called. Returns false if the image will be automatically converted when Write() is called. Returns false if the image cannot be added at all. See the preconditions of Write() for more information.
Implements#
IVideoWriter.CanWriteWithoutConversion(PixelType, Int32, Int32, Int32, ImageOrientation)
Remarks#
Thread Safety: This method is thread-safe.
Error Safety: Does not throw exceptions.
VideoWriter.Close Method#
Closes the file.
Syntax#
C#
VB
Implements#
Remarks#
Thread Safety: This method is thread-safe.
Error Safety: Does not throw exceptions.
VideoWriter.Create Method (String, Double, ICamera)#
Creates and opens a file for video writing.
Syntax#
C#
VB
Public Overridable Sub Create (
filename As String,
playbackFramesPerSecond As Double,
camera As ICamera
)
Parameters#
- filename
- Type: System.String
File name of the video file to be created. If the file doesn't have the an extension, .mp4 will be appended automatically. Existing files will be overwritten. - playbackFramesPerSecond
- Type: System.Double
Playback speed in frames per second. - camera
- Type: Basler.Pylon.ICamera
The camera from which the current settings are read.
Implements#
IVideoWriter.Create(String, Double, ICamera)
Remarks#
This overload reads the PixelType, Width, and Height parameters from the camera passed.
Preconditions:
- The file is writable.
- The camera must be open.
- The pixel type must be supported by the image format converter.
Error Safety: Can throw exceptions if the file cannot be created successfully or the preconditions are not met.
VideoWriter.Create Method (String, Double, PixelType, Int32, Int32)#
Creates and opens a file for video writing.
Syntax#
C#
public virtual void Create(
string filename,
double playbackFramesPerSecond,
PixelType pixelType,
int width,
int height
)
VB
Public Overridable Sub Create (
filename As String,
playbackFramesPerSecond As Double,
pixelType As PixelType,
width As Integer,
height As Integer
)
Parameters#
- filename
- Type: System.String
File name of the video file to be created. If the file doesn't have the an extension, .mp4 will be appended automatically. Existing files will be overwritten. - playbackFramesPerSecond
- Type: System.Double
Playback speed in frames per second. - pixelType
- Type: Basler.Pylon.PixelType
The pixel type of the images that will be added to the video writer. This input is used to derive the video format. Currently, the output is always YUV420p. - width
- Type: System.Int32
Width of the video. - height
- Type: System.Int32
Height of the video.
Implements#
IVideoWriter.Create(String, Double, PixelType, Int32, Int32)
Remarks#
Preconditions:
- The file is writable.
width
andheight
must be greater than 0.pixelType
is supported by the image format converter.
Error Safety: Can throw exceptions if the file cannot be created successfully or the preconditions are not met.
VideoWriter.Create Method (String, Double, PixelType, Int32, Int32, UInt32)#
Creates and opens a file for video writing.
Syntax#
C#
public virtual void Create(
string filename,
double playbackFramesPerSecond,
PixelType pixelType,
int width,
int height,
uint quality
)
VB
Public Overridable Sub Create (
filename As String,
playbackFramesPerSecond As Double,
pixelType As PixelType,
width As Integer,
height As Integer,
quality As UInteger
)
Parameters#
- filename
- Type: System.String
File name of the video file to be created. If the file doesn't have the an extension, .mp4 will be appended automatically. Existing files will be overwritten. - playbackFramesPerSecond
- Type: System.Double
Playback speed in frames per second. - pixelType
- Type: Basler.Pylon.PixelType
The pixel type of the images that will be added to the video writer. This input is used to derive the video format. Currently, the output is always YUV420p. - width
- Type: System.Int32
Width of the video. - height
- Type: System.Int32
Height of the video. - quality
- Type: System.UInt32
Quality of the video.
Remarks#
Preconditions:
- The file is writable.
pixelType
is supported by the image format converter.width
andheight
must be greater than 0.quality
must be in the range 1 … 100.
Error Safety: Can throw exceptions if the file cannot be created successfully or the preconditions are not met.
VideoWriter.Dispose Method#
Releases all resources used by the VideoWriter
Syntax#
C#
VB
VideoWriter.Write Method (IImage)#
Writes an image to the video.
Syntax#
C#
VB
Parameters#
- image
- Type: Basler.Pylon.IImage
The image to be added.
Implements#
Remarks#
If required, the image is automatically converted to the target format.
Preconditions
- The file is open.
- The image is valid.
- The pixel type of the image is supported by pylon.
- The width and height of the image match the values passed when opening the video file.
Thread Safety: This method is thread-safe.
Error Safety: Does not throw exceptions.
VideoWriter.Write(T) Method (T[], PixelType, Int32, Int32, Int32, ImageOrientation)#
Writes the image to the video.
Syntax#
C#
public virtual void Write<T>(
T[] pixelData,
PixelType pixelType,
int width,
int height,
int paddingX,
ImageOrientation orientation
)
VB
Public Overridable Sub Write(Of T) (
pixelData As T(),
pixelType As PixelType,
width As Integer,
height As Integer,
paddingX As Integer,
orientation As ImageOrientation
)
Parameters#
- pixelData
- Type: T[]
The data of the image to be written. - pixelType
- Type: Basler.Pylon.PixelType
The pixel type of the image. - width
- Type: System.Int32
Width of the image. - height
- Type: System.Int32
Height of the image. - paddingX
- Type: System.Int32
The number of extra data bytes at the end of each row inpixelData
- orientation
- Type: Basler.Pylon.ImageOrientation
Orientation of the image data inpixelData
.
Type Parameters#
- T
- The data type of pixels stored in
pixelData
.
Implements#
IVideoWriter.Write(T)(T[], PixelType, Int32, Int32, Int32, ImageOrientation)
Remarks#
If required, the image is automatically converted to the target format.
Preconditions
- The file is open.
- The pixel type of the image is supported by pylon.
- The width and height of the image match the values passed when opening the video file.
Error Safety: Does not throw exceptions.
VideoWriter Constructor#
Initializes a new instance of the VideoWriter class.
Syntax#
C#
VB
Remarks#
Creates and initializes a new instance of the VideoWriter class.
Error Safety: Can throw exceptions.
VideoWriter.CanWriteWithoutConversion Method#
Overload List#
Name | Description | |
---|---|---|
CanWriteWithoutConversion(IImage) | Checks whether the image passed can be added to the video file without prior conversion. | |
CanWriteWithoutConversion(PixelType, Int32, Int32, Int32, ImageOrientation) | Checks whether the given data/image can be added to the video file without prior conversion. |
VideoWriter.Create Method#
Overload List#
Name | Description | |
---|---|---|
Create(String, Double, ICamera) | Creates and opens a file for video writing. | |
Create(String, Double, PixelType, Int32, Int32) | Creates and opens a file for video writing. | |
Create(String, Double, PixelType, Int32, Int32, UInt32) | Creates and opens a file for video writing. |
VideoWriter.Write Method#
Overload List#
Name | Description | |
---|---|---|
Write(IImage) | Writes an image to the video. | |
Write(T)(T[], PixelType, Int32, Int32, Int32, ImageOrientation) | Writes the image to the video. |
VideoWriter.ImageDataBytesWritten Property#
Returns the amount of image data written to the video file in bytes.
Syntax#
C#
VB
Property Value#
Type: Int64
Remarks#
This value is updated with each call to Write().
Return Value#
Type: Int64
Returns the amount of image data bytes that have been written to the file. Returns 0 if no images have been written yet.
Thread Safety: This method is thread-safe.
Error Safety: Does not throw exceptions.
VideoWriter.IsOpen Property#
Returns the open state of the video file.
Syntax#
C#
VB
Return Value#
Type: Boolean
Returns true if a file for video output has been opened.
Implements#
Remarks#
Thread Safety: This method is thread-safe.
Error Safety: Does not throw exceptions.
VideoWriter.IsSupported Property#
Checks if video writing is supported.
Syntax#
C#
VB
Property Value#
Type: Boolean
Remarks#
Checks if all neccessary dynamic libraries are installed and can be loaded. This does not check if the codec for the video can be used. This is checked in Create().
Return Value#
Type: Boolean
Returns true if supported (i.e. all DLLs are okay and can be loaded)
Thread Safety: This method is thread-safe.
Error Safety: Does not throw exceptions.
VideoWriter.Parameters Property#
Returns the parameter collection of the video writer for accessing all parameters. Example: videowriter.Parameters[PLVideoWriter.BytesWritten].GetValue();
Syntax#
C#
VB
Return Value#
Type: IParameterCollection
Returns the parameter collection of the video writer.
Remarks#
You can use the parameter collection to configure the video writer through parameters. You can access parameters by their name or predefined parameter list.
Currently the only predefined parameter list is:
- PLVideoWriter
You can access parameters by passing a key from a parameter list to the index operator, e.g. C#
Thread Safety: This method is thread-safe.
Error Safety: Does not throw exceptions.