Supports writing video files.
More...
#include <pylon/VideoWriter.h>
|
| 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::INodeMap & | GetNodeMap () |
| Provides access to all parameters via a nodemap. More...
|
|
|
CLock & | GetLock () |
| Provides access to the lock used for synchronizing the access to the video writer. More...
|
|
Supports writing video files.
- Note
- Note that a supplementary software package containing additional libraries has to be installed for this.
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.
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] | pBuffer | The pointer to the buffer of the image. |
[in] | bufferSize | The size of the buffer in byte. |
[in] | pixelType | The pixel type of the image to save. |
[in] | width | The number of pixels in a row of the image to save. |
[in] | height | The number of rows of the image to save. |
[in] | paddingX | The number of extra data bytes at the end of each line. |
[in] | orientation | The 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] | image | The 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().
Can be used to check whether the given image is added to the video file without prior conversion when Add() is called.
- Parameters
-
[in] | pixelType | The pixel type of the image to save. |
[in] | width | The number of pixels in a row of the image to save. |
[in] | height | The number of rows of the image to save. |
[in] | paddingX | The number of extra data bytes at the end of each row. |
[in] | orientation | The 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] | image | The 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.
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.
Opens a video file for writing.
If a file with the same filename
already exists, it will be overwritten.
- Parameters
-
[in] | filename | Name 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] | width | The number of pixels in a row of the video file to save. |
[in] | height | The number of rows of the video file to save. |
[in] | inputPixelType | 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. |
[in] | framesPerSecondPlaybackSpeed | The playback speed in frames per second. |
[in] | quality | The 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()).
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
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
Width of the image (in pixels)
Visibility: Invisible
The documentation for this class was generated from the following file: