VOutputV4L2 C++ lib. Simple interface to write video frame to V4L2 output devices
VOutputV4L2 C++ library version 1.0.4 provides video output based on V4L2 API for Linux OS.
We sell source code of this library as is, without future updates and technical support according to perpetual non-exclusive royalty-free license. You pay once and can use this library in your software and hardware products without limits. Please read the license agreement before purchasing: LICENSE. You can buy technical support service for this product.
VOutputV4L2 C++ library version 1.0.4 provides video output based on V4L2 API for Linux OS.
We sell source code of this library as is, without future updates and technical support according to perpetual non-exclusive royalty-free license. You pay once and can use this library in your software and hardware products without limits. Please read the license agreement before purchasing: LICENSE. You can buy technical support service for this product.
VOutputV4L2 C++ library version 1.0.4 provides video output based on V4L2 API for Linux OS.
We sell source code of this library as is, without future updates and technical support according to perpetual non-exclusive royalty-free license. You pay once and can use this library in your software and hardware products without limits. Please read the license agreement before purchasing: LICENSE. You can buy technical support service for this product.
Purchase options
You can buy the software by bank transfer. Bank transfer available only for companies. To buy software by bank transfer please send us request to info@constantrobotics.com. Also, you can buy technical support service for this product.
Downloads
Programmer’s manual: DOWNLOAD
Overview
VOutputV4L2 C++ library provide interface to write video frame to V4L2 video devices in Linux OS. An example of a video device is v4l2loopback device (virtual video devices). Normal (v4l2) applications will read these devices as if they were ordinary video devices, but the video will not be read from e.g. a capture card but instead it is generated by user's application. Using the library user's application can be as video source for third-party processes. The library provides simple interface. It depends on open source Frame library (describes video frame structure and pixel formats, source code included, Apache 2.0 license) and open source Logger library (provides functions to write logs, source code included, Apache 2.0 license). The library supports C++17 standard and works only on Linux with V4L2 API support. The library supports C++17 standard. Additionally test application depends on OpenCV library to provide user interface.
Simple interface
namespace cr
{
namespace video
{
/// V4L2 video output device class.
class VOutputV4L2
{
public:
/// Get library version.
static std::string getVersion();
/// Class constructor.
VOutputV4L2();
/// Class destructor.
~VOutputV4L2();
/// Open device.
bool open(std::string device);
/// Write video frame to device.
bool write(Frame& frame);
/// Set log level.
void setLogLevel(cr::utils::PrintFlag flag);
/// Close device.
void close(void);
};
}
}
Simple example
#include <iostream>
#include "VOutputV4L2.h"
int main(void)
{
// Open video device.
cr::video::VOutputV4L2 videoOutput;
if(!videoOutput.open("/dev/video4"))
return -1;
// Create YUV frame with certain resolution.
cr::video::Frame frame(640, 480, cr::video::Fourcc::YUV24);
// Main loop.
uint8_t value = 0;
while (true)
{
// Fill image by color.
memset(frame.data, value++, frame.size);
// Write frame to device.
if(!videoOutput.write(frame))
std::cerr << "Cant' write frame" << std::endl;
// 33ms delay for 30 fps stream
std::this_thread::sleep_for(std::chrono::milliseconds(33));
}
return 1;
}