RtspServer C++ lib. Powerful RTSP server (H264 and HEVC) C++ library for Linux and Windows

€4,000.00

The RtspServer is a C++ library version 2.0.0 implements RTSP server. The RtspServer library inherits interface from VStreamer class, and can be included in any C++ project for Linux and Windows.

LICENSE: 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: DOWNLOAD LICENSE. You can buy technical support service for this product.

Add To Cart
Technical support service
Options:

Purchase options

You can by this software online by card or 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.

Overview

The RtspServer is a C++ library implements RTSP server. The RtspServer library inherits interface from VStreamer class, and can be included in any C++ project for Linux and Windows. It allows developer to create a RTSP server and set general parameters: RTSP server port, IP, stream name, user name and password. The library accepts RAW pixel formats (BGR24, RGB24, GRAY, YUYV, UYVY, NV12, NV21, YU12 and YV12) and compressed data (H264 and HEVC). It supports H264 and HEVC video streams and also supports multicast video streaming. If the input video frame is in a compressed format (H264 or HEVC), it bypasses any overlay and resizing processes and is sent directly to clients. However, if the frame is RAW format, it undergoes a series of processing steps. First, resizing is performed if necessary, followed by the application of any required overlay. Finally, the processed frame is encoded by video codec before being transmitted to clients (to use this functions the user must define video codec and video overlay implementation according to VCodec, VOverlay interfaces). The library relies on several dependencies, including VStreamer class (defines interface, source code included, Apache 2.0 license), FormatConverterOpenCv (provides methods to convert pixel formats, source code included) and OpenCV (version 4.5 and higher, Apache 2.0 license). Additionally example depends on VSourceFile library (provides interface to capture compressed video from files, source code included). It has been specifically tested and verified for functionality on the Linux and Windows operating systems. The RTSP server provided by library compatible with all popular RTSP clients: ffmpeg, gstreamer, VLC, Milestone etc.

Downloads

Programmer’s manual: DOWNLOAD

Simple interface

class RtspServer : public cr::video::VStreamer
{
public:

    /// Get string of current library version.
    static std::string getVersion();

    /// Init RTSP server.
    bool initVStreamer(cr::video::VStreamerParams &params,
                       cr::video::VCodec *codec = nullptr,
                       cr::video::VOverlay *overlay = nullptr) override;

    /// Get initialization status.
    bool isVStreamerInit() override;

    /// Close RTSP server.
    void closeVStreamer() override;

    /// Send frame to RTSP server.
    bool sendFrame(cr::video::Frame& frame) override;

    /// Set RTSP server parameter.
    bool setParam(cr::video::VStreamerParam id, float value) override;

    /// Set RTSP server parameter.
    bool setParam(cr::video::VStreamerParam id, std::string value) override;

    /// Get RTSP server parameters.
    void getParams(cr::video::VStreamerParams& params) override;

    /// Execute action command.
    bool executeCommand(cr::video::VStreamerCommand id) override;
};

Simple example

#include <iostream>
#include "RtspServer.h"
#include "VSourceFile.h"

int main(void)
{
    std::cout << "RtspServer v" <<
    cr::rtsp::RtspServer::getVersion() << std::endl;

    // Create and init RTSP server.
    cr::video::VStreamerParams params;
    params.port = 7031;
    params.ip = "127.0.0.1";
    params.suffix = "live";
    params.user = ""; // No user name.
    params.password = ""; // No password.
    params.fps = 30;
    cr::rtsp::RtspServer server;
    if(!server.initVStreamer(params))
        return -1;

    std::cout << "RTSP init string: rtsp://" << params.ip <<
    ":" << params.port << "/" << params.suffix << std::endl;

    // Init file video source.
    cr::video::VSourceFile fileSource;
    std::string initString = "out.h264;1920;1080;30";
    if(!fileSource.openVSource(initString))
        return -1;

    // Main thread.
    cr::video::Frame sourceFrame;
    while(1)
    {
        // Get new frame from video file.
        if(!fileSource.getFrame(sourceFrame))
        {
            std::cout << "Could not get frame" << std::endl;
            continue;
        }
        
        // Send frame to RTSP server.
        if(!server.sendFrame(sourceFrame))
            std::cout << "Could not send frame" << std::endl;
    }
    return 1;
}
RtspServerLive555 C++ lib. RTSP server (H264, HEVC and JPEG) C++ library for Linux
€4,000.00