A class to create compressed video stream from images captured or loaded using the Impact Acquire API.
More...
|
const TVideoCodec & | getCodec (void) const |
| Returns the codec used by this video stream.
|
|
std::string | getCodecAsString (void) const |
| Returns the codec used by this video stream as a string.
|
|
const std::string & | getFileName (void) const |
| Returns the file name of this video stream.
|
|
bool | isPaused (void) const |
| Checks is this video stream is currently paused.
|
|
int | pause (void) const |
| Pauses this video stream.
|
|
int | resume (void) const |
| Resumes this video stream.
|
|
int | saveImage (const ImageBuffer *pBuffer, int64_type timestamp_us=0LL) |
| Stores an image into the video stream.
|
|
int | saveImage (Device *pDev, const Request *pRequest) |
| Encodes and stores the image associated with the mvIMPACT::acquire::Request object into the stream.
|
|
| VideoStream (const std::string &fileName, const ImageBuffer *pBuffer, const TVideoCodec codec=vcH264, const unsigned int quality_pc=60, const unsigned int bitrate=6000) |
| Creates a new video stream file.
|
|
| VideoStream (const std::string &fileName, const Request *pRequest, const TVideoCodec codec=vcH264, const unsigned int quality_pc=60, const unsigned int bitrate=6000) |
| Creates a new video stream file.
|
|
| VideoStream (const std::string &fileName, const unsigned int imageWidth, const unsigned int imageHeight, const TVideoCodec codec=vcH264, const unsigned int quality_pc=60, const unsigned int bitrate=6000) |
| Creates a new video stream file.
|
|
| ~VideoStream () |
|
A class to create compressed video stream from images captured or loaded using the Impact Acquire API.
This class heavily depends on the FFmpeg project (see FFmpeg). Without the libraries belonging to this project being present on the target system video streams cannot be created.
Because of what is stated in the above section Impact Acquire is NOT shipped with the FFmpeg binaries required to use this class!
On Windows the FFmpeg-share package matching the platform the application shall run with (32- or 64-bit) is needed. This can either be extracted into the installation folder of Impact Acquire e.g. into $(MVIMPACT_ACQUIRE_DIR)/Toolkits/ffmpeg-4.2.2-win64-shared or $(MVIMPACT_ACQUIRE_DIR)/Toolkits/ffmpeg-4.2.2-win32-shared (Works only for this versions) OR at the location pointed to by MVIMPACT_ACQUIRE_FFMPEG_DIR (see below) OR anywhere into the systems search path.
On Linux the package ffmpeg must be installed and if e.g. H.264 support is needed the libavcodec-extra package as well.
- Attention
- Please carefully read and understand the legal implications coming with the use of FFmpeg in a commercial product: http://ffmpeg.org/legal.html
Impact Acquire is capable of communicating with FFmpeg 4.x right now. This means that the following libraries will be recognized:
- libavcodec-58, libavformat-58 and libavutil-56 (FFmpeg 4.0 was released on 20.04.2018)
In order to load the FFmpeg libraries from a custom location the environment variable MVIMPACT_ACQUIRE_FFMPEG_DIR can be defined before creating the first mvIMPACT::acquire::labs::VideoStream instance after loading the mvDeviceManager library into the current processes address space. Without this environment variable only the systems default search path will be used to locate it and (Windows only) the Toolkits folder of the installation directory. This is how the search algorithm will operate:
if isEnvironmentVariableDefined( MVIMPACT_ACQUIRE_FFMPEG_DIR )
if tryToLoadFFmpegVersion4Succeeded
return
if tryToLoadFFmpegVersion3Succeeded
return
if isWindowsSystem
if tryToLoadFFmpegVersionFromToolkits4Succeeded
return
if tryToLoadFFmpegVersion4Succeeded
return
if tryToLoadFFmpegVersion3Succeeded
return
ReportError
- Note
- Currently video streams can only be created for a limited number of pixel formats. Which codec supports which input formats is described at the corresponding mvIMPACT::acquire::TVideoCodec value. Make sure to use one of these formats either by setting up your device accordingly or by using the mvIMPACT::acquire::ImageDestination::pixelFormat property of the Image Format Conversion Filter.
- Attention
- You have to feed one of the supported pixel formats depending on the video codecs requirements into the stream! The video stream API will NOT perform internal conversion. If you need to convert (most likely you will be!) use the Image Format Conversion Filter to achieve that. It will get the job done!
- When not providing timestamps together with the images that are fed into the encoder the resulting video stream can still be used, but the playback speed will differ from the acquisition speed then. When providing the timestamps coming with the requests the playback speed will resemble exactly the acquisition speed. Most codecs even support variable playback speeds so dynamic changes in the frame rate will be reflected during playback.
- Since
- 2.39.0