RtspServerLive555 C++ lib. RTSP server (H264, HEVC and JPEG) C++ library for Linux

€2,000.00

The RtspServerLive555 is a C++ library provides RTSP server with H264, HEVC and JPEG support. The library based on popular opensource library Live555 and provides simple interface to include in any C++ project.

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: LICENSE.

The RtspServerLive555 is a C++ library provides RTSP server with H264, HEVC and JPEG support. The library based on popular opensource library Live555 and provides simple interface to include in any C++ project.

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: LICENSE.

Overview

The RtspServerLive555 is a C++ library that implements an RTSP server. The library is based on the popular open source library Live555 (source code not included, just linked). It provides a simple interface according to the VStreamer interface class and can be included in any C++ project. It allows developers to create an RTSP server without the complexity of the Live555 library. Users can set general RTSP server parameters: RTSP server port, IP, stream name, user name and password. The server works frame-by-frame: users put video frames. RtspServerLive555 accepts both raw pixel formats and compressed formats like H264, HEVC or JPEG. If the frame is in a compressed format (H264, HEVC or JPEG), it bypasses any overlay and resizing processes and is sent directly to clients. However, if the frame is raw, 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 into a compressed format before being transmitted to clients (to use these functions the user must define video codec and video overlay implementation according to VCodec, VOverlay interfaces). The library relies on several dependencies: VCodec (defines video codec interface, source code included, Apache 2.0 license), VOverlay (defines video overlay interface, source code included, Apache 2.0 license), FormatConverterOpenCv (provides methods to convert pixel formats, source code included), ConfigReader (provides methods to work with JSON files, source code included, Apache 2.0 license) and OpenCV (version 4.5 and higher, video scaling functions). It has been specifically tested and verified for functionality on the Linux operating system. It uses the C++17 standard. The RTSP server provided by the library is compatible with all popular RTSP clients: ffmpeg, gstreamer, VLC, Milestone etc.

Documentation

Documentation: GO TO DOCUMENTATION

Simple interface

class RtspServerLive555
{
public:
    /// Get class version string.
    static std::string getVersion();

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

    /// Set param.
    bool setParam(RtspServerParam id, float value);

    /// Set param.
    bool setParam(RtspServerParam id, std::string value);

    /// Get RTSP server params.
    void getParams(RtspServerParams& params);

    /// Execute command.
    bool executeCommand(RtspServerCommand id);

    /// Send frame.
    bool sendFrame(cr::video::Frame& frame);

    /// Close RTSP server.
    void close();
};

Simple example

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

// Link namespaces.
using namespace std;
using namespace cr::rtsp;
using namespace cr::video;

// Entry point.
int main(void)
{
    // Init RTSP server params for encoded frames by default params.
    RtspServerParams params;
    params.port = 7031;
    params.ip = "0.0.0.0";
    params.suffix = "live";
    params.user = ""; // No user name.
    params.password = ""; // No password.
    params.fps = 30;

    // RTSP server.
    RtspServerLive555 server;
    if(!server.init(params))
        return -1;
    cout << "RTSP init string: rtsp://127.0.0.1:7031/live" << endl;

    // Init file video source.
    VSourceFile fileSource;
    if(!fileSource.openVSource("out.264;1280;720;30"))
        return -1;

    // Main thread.
    Frame sourceFrame;
    while(1)
    {
        // Get new frame from video file.
        if(!fileSource.getFrame(sourceFrame, 1000))
            continue;
        
        // Send frame to RTSP server.
        if(!server.sendFrame(sourceFrame))
            cout << "Can not send frame to rtsp server" << endl;
    }
    return 1;
}