Pylon Logo Basler Logo
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
Pylon::CVideoWriter Class Reference

Supports writing video files. More...

#include <pylon/VideoWriter.h>

Inheritance diagram for Pylon::CVideoWriter:
Inheritance graph
[legend]

Public Member Functions

 CVideoWriter ()
 Creates a video writer object. More...
 
virtual ~CVideoWriter ()
 Destroys the video writer object. More...
 
virtual void SetParameter (uint32_t width, uint32_t height, EPixelType inputPixelType, double framesPerSecondPlaybackSpeed, uint32_t quality)
 Easy way to set parameters required for video recording. More...
 
virtual void Open (const Pylon::String_t &filename)
 Opens a video file for writing. More...
 
virtual bool IsOpen () const
 Returns the open state of the video file. More...
 
virtual void Close ()
 Closes the video file. More...
 
virtual void Add (const void *pBuffer, size_t bufferSize, Pylon::EPixelType pixelType, uint32_t width, uint32_t height, size_t paddingX, Pylon::EImageOrientation orientation)
 Adds the image to the video file. More...
 
virtual void Add (const Pylon::IImage &image)
 Adds the image to the video file. More...
 
virtual bool CanAddWithoutConversion (Pylon::EPixelType pixelType, uint32_t width, uint32_t height, size_t paddingX, Pylon::EImageOrientation orientation)
 Can be used to check whether the given image is added to the video file without prior conversion when Add() is called. More...
 
virtual bool CanAddWithoutConversion (const Pylon::IImage &image)
 Can be used to check whether the given image is added to the video file without prior conversion when Add() is called. More...
 
virtual GenApi::INodeMapGetNodeMap ()
 Provides access to all parameters via a nodemap. More...
 

Static Public Member Functions

static bool IsSupported ()
 Checks if video writing is supported. More...
 

Public Attributes

Categories: RecordingOptions
Pylon::IIntegerExBitrate
 Bit rate of the resulting compressed stream. More...
 
Pylon::IEnumParameterT< CompressionModeEnums > & CompressionMode
 Sets the compression mode. More...
 
Pylon::IFloatExPlaybackFrameRate
 Frame rate (in Hertz) of the video to be recorded. More...
 
Pylon::IFloatExQuality
 Quality of the resulting compressed stream. More...
 
Pylon::IIntegerExThreadCount
 Number of threads used for recording the video. More...
 
Categories: Statistics
Pylon::IIntegerExBytesWritten
 Bytes written to file since starting the recording. More...
 
Pylon::IIntegerExFrameCount
 Number of frames written since starting the recording. More...
 
Categories: ImageParameters
Pylon::IIntegerExHeight
 Height of the image (in pixels) More...
 
Pylon::IIntegerExWidth
 Width of the image (in pixels) More...
 

Protected Member Functions

CLockGetLock ()
 Provides access to the lock used for synchronizing the access to the video writer. More...
 

Detailed Description

Supports writing video files.

Note
Note that a supplementary software package containing additional libraries has to be installed for this.

Constructor & Destructor Documentation

Pylon::CVideoWriter::CVideoWriter ( )

Creates a video writer object.

Error Safety:
Throws a RuntimeException when no memory can be allocated.
virtual Pylon::CVideoWriter::~CVideoWriter ( )
virtual

Destroys the video writer object.

Error Safety:
Does not throw C++ exceptions.

Member Function Documentation

virtual void Pylon::CVideoWriter::Add ( const void *  pBuffer,
size_t  bufferSize,
Pylon::EPixelType  pixelType,
uint32_t  width,
uint32_t  height,
size_t  paddingX,
Pylon::EImageOrientation  orientation 
)
virtual

Adds the image to the video file.

Converts the image to the correct format if required.

The image is automatically converted to YUV420p unless the input pixelType is already YUV420p. The orientation of the image is always converted to ImageOrientation_TopDown unless the inputpixelType is YUV420p. In that case, the orientation of the image must already be ImageOrientation_TopDown. See preconditions.

Parameters
[in]pBufferThe pointer to the buffer of the image.
[in]bufferSizeThe size of the buffer in byte.
[in]pixelTypeThe pixel type of the image to save.
[in]widthThe number of pixels in a row of the image to save.
[in]heightThe number of rows of the image to save.
[in]paddingXThe number of extra data bytes at the end of each line.
[in]orientationThe vertical orientation of the image in the image buffer.
Precondition
  • The file is open.
  • The image added is valid.
  • The pixelType of the image to add is a supported input format of the Pylon::CImageFormatConverter or YUV420p.
  • If the pixelType is YUV420p the orientation has to be ImageOrientation_TopDown.
  • The width and height of the image match the values passed when opening the video file.
Error Safety:
Throws an exception if the image cannot be added.
Thread Safety:
This method is synchronized using the lock provided by GetLock().
virtual void Pylon::CVideoWriter::Add ( const Pylon::IImage image)
virtual

Adds the image to the video file.

Converts the image to the correct format if required.

The image is automatically converted to YUV420p unless the input pixelType is already YUV420p. The orientation of the image is always converted to ImageOrientation_TopDown unless the input pixelType is YUV420p. In that case, the orientation of the image must already be ImageOrientation_TopDown. See preconditions.

Parameters
[in]imageThe image to add, e.g., a CPylonImage, CPylonBitmapImage, or Grab Result Smart Pointer object.
Precondition
  • The file is open.
  • The image added is valid.
  • The pixelType of the image to add is a supported input format of the Pylon::CImageFormatConverter or YUV420p.
  • If the pixelType is YUV420p the orientation has to be ImageOrientation_TopDown.
  • The width and height of the image match the values passed when opening the video file.
Error Safety:
Throws an exception if the image cannot be added.
Thread Safety:
This method is synchronized using the lock provided by GetLock().
virtual bool Pylon::CVideoWriter::CanAddWithoutConversion ( Pylon::EPixelType  pixelType,
uint32_t  width,
uint32_t  height,
size_t  paddingX,
Pylon::EImageOrientation  orientation 
)
virtual

Can be used to check whether the given image is added to the video file without prior conversion when Add() is called.

Parameters
[in]pixelTypeThe pixel type of the image to save.
[in]widthThe number of pixels in a row of the image to save.
[in]heightThe number of rows of the image to save.
[in]paddingXThe number of extra data bytes at the end of each row.
[in]orientationThe vertical orientation of the image data in the video file.
Returns
Returns true if the image is added to the video stream without prior conversion when Add() is called. Returns false if the image is automatically converted when Add() is called. Returns false if the image cannot be added at all. See the preconditions of Add() for more information.
Error Safety:
Does not throw C++ exceptions.
virtual bool Pylon::CVideoWriter::CanAddWithoutConversion ( const Pylon::IImage image)
virtual

Can be used to check whether the given image is added to the video file without prior conversion when Add() is called.

Parameters
[in]imageThe image to save, e.g. a CPylonImage, CPylonBitmapImage, or Grab Result Smart Pointer object.
Returns
Returns true if the image is added to the video stream without prior conversion when Add() is called. Returns false if the image is automatically converted when Add() is called. Returns false if the image cannot be added at all. See the preconditions of Add() for more information.
Error Safety:
Does not throw C++ exceptions.
virtual void Pylon::CVideoWriter::Close ( )
virtual

Closes the video file.

Error Safety:
Does not throw C++ exceptions.
Thread Safety:
This method is synchronized using the lock provided by GetLock().
CLock& Pylon::CVideoWriter::GetLock ( )
protected

Provides access to the lock used for synchronizing the access to the video writer.

Error Safety:
Does not throw C++ exceptions.
virtual GenApi::INodeMap& Pylon::CVideoWriter::GetNodeMap ( )
virtual

Provides access to all parameters via a nodemap.

Error Safety:
Does not throw C++ exceptions.
virtual bool Pylon::CVideoWriter::IsOpen ( ) const
virtual

Returns the open state of the video file.

Returns
Returns true if open.
Error Safety:
Does not throw C++ exceptions.
Thread Safety:
This method is synchronized using the lock provided by GetLock().
static bool Pylon::CVideoWriter::IsSupported ( )
static

Checks if video writing is supported.

Checks if all necessary dynamic libraries of the supplementary software package are installed and can be loaded. This does not check if the codec for the video can be used. This is checked in Open().

Returns
Returns true if video writing is supported.
Error Safety:
Does not throw C++ exceptions.
virtual void Pylon::CVideoWriter::Open ( const Pylon::String_t filename)
virtual

Opens a video file for writing.

If a file with the same filename already exists, it will be overwritten.

Parameters
[in]filenameName and path of the video file.
Precondition
  • The VideoWriter ist closed.
  • The width and height parameters are larger than 1.
Error Safety:
Throws an exception if the video file cannot be opened. Throws an exception if the current parameters do not meet codec requirements.
Thread Safety:
This method is synchronized using the lock provided by GetLock().
virtual void Pylon::CVideoWriter::SetParameter ( uint32_t  width,
uint32_t  height,
EPixelType  inputPixelType,
double  framesPerSecondPlaybackSpeed,
uint32_t  quality 
)
virtual

Easy way to set parameters required for video recording.

This is a convenient way to set all required parameters in a single function call. The parameters width, height, framesPerSecondPlaybackSpeed and quality are set in the nodemap. The parameter inputPixelType is checked for its convertibility to YUV420p or whether it is already YUV420p. Advanced parameters can be accessed using the nodemap provided by GetNodeMap().

Parameters
[in]widthThe number of pixels in a row of the video file to save.
[in]heightThe number of rows of the video file to save.
[in]inputPixelTypeThe 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.
[in]framesPerSecondPlaybackSpeedThe playback speed in frames per second.
[in]qualityThe quality setting, valid range is 1 ... 100.
Precondition
The VideoWriter ist closed.
Error Safety:
Throws a C++ exception when a parameter is out of range, set to an invalid value or parameters cannot be changed (e.g., after calling Open()).

Member Data Documentation

Pylon::IIntegerEx& Basler_VideoWriterParams::CVideoWriterParams_Params_v6_1_0::Bitrate
inherited

Bit rate of the resulting compressed stream.

Visibility: Beginner

Pylon::IIntegerEx& Basler_VideoWriterParams::CVideoWriterParams_Params_v6_1_0::BytesWritten
inherited

Bytes written to file since starting the recording.

Visibility: Beginner

Pylon::IEnumParameterT<CompressionModeEnums>& Basler_VideoWriterParams::CVideoWriterParams_Params_v6_1_0::CompressionMode
inherited

Sets the compression mode.

Sets the compression mode. You can choose whether to keep the bit rate or the quality of the resulting video stream constant.

Visibility: Beginner

Pylon::IIntegerEx& Basler_VideoWriterParams::CVideoWriterParams_Params_v6_1_0::FrameCount
inherited

Number of frames written since starting the recording.

Visibility: Beginner

Pylon::IIntegerEx& Basler_VideoWriterParams::CVideoWriterParams_Params_v6_1_0::Height
inherited

Height of the image (in pixels)

Visibility: Invisible

Pylon::IFloatEx& Basler_VideoWriterParams::CVideoWriterParams_Params_v6_1_0::PlaybackFrameRate
inherited

Frame rate (in Hertz) of the video to be recorded.

Visibility: Beginner

Pylon::IFloatEx& Basler_VideoWriterParams::CVideoWriterParams_Params_v6_1_0::Quality
inherited

Quality of the resulting compressed stream.

Quality of the resulting compressed stream. The quality has a direct influence on the resulting bit rate. The optimal bit rate is calculated based on the input values height, width, and playback frame rate (WIDTH * HEIGHT * PLAYBACKFRAMERATE * 0.25). This is then normalized to the quality value range 1-100, where 100 corresponds to the optimum bit rate and 1 to the lowest bit rate.

Visibility: Beginner

Pylon::IIntegerEx& Basler_VideoWriterParams::CVideoWriterParams_Params_v6_1_0::ThreadCount
inherited

Number of threads used for recording the video.

Visibility: Expert

Pylon::IIntegerEx& Basler_VideoWriterParams::CVideoWriterParams_Params_v6_1_0::Width
inherited

Width of the image (in pixels)

Visibility: Invisible


The documentation for this class was generated from the following file:

pylon 6.1.0
Copyright (c) 2006-2020 Basler AG (Mon Mar 16 2020 10:57:00)