VCodecUniversal C++ lib. H264, HEVC (H.265) and JPEG encoding and decoding with one class for different platforms.

€4,000.00

VCodecUniversal C++ library provides video encoding and decoding functions for H264, HEVC(H265) and JPEG codecs for different platforms.

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.

VCodecUniversal C++ library provides video encoding and decoding functions for H264, HEVC(H265) and JPEG codecs for different platforms.

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 VCodecUniversal C++ library provides video encoding and decoding of H264, HEVC (H.265) and JPEG with one class for different platforms. The VCodecUniversal class implements the VCodec interface, the library includes software decoders for H264, HEVC (H.265), JPEG and JPEG encoder. The library is written in C++17 and is supplied as source code only. Tested platforms and their backend:

Platform H.264 (Enc / Dec) HEVC (Enc / Dec) JPEG (Enc / Dec) Backend
Windows 11 x64 (Intel i7-13700H, NVIDIA RTX 4050) HW / HW HW / HW SW / SW Media Foundation / WIC
Linux x86-64 (Ubuntu 24.04 WSL 2, NVIDIA RTX 4050) HW / HW HW / HW SW / HW NVENC/NVDEC, SW JPEG
Intel Atom x7835RE (SECO E08, Ubuntu 24.04) HW / HW HW / HW HW / HW VA-API
NVIDIA Jetson Orin NX (Jetson Linux R36.4.7) HW / HW HW / HW SW / SW V4L2, SW JPEG
NVIDIA Jetson Nano (Jetson Linux R32.7.1) HW / HW HW / HW SW / SW V4L2, SW JPEG
NXP i.MX95 (Toradex SMARC, Linux 6.6) HW / HW HW / HW HW / HW V4L2
NXP i.MX8M Plus (Toradex SMARC, Linux 6.6) HW / SW HW / SW SW / SW V4L2, SW Decoders & JPEG
Raspberry Pi 4 Model B (Debian 12, Linux 6.12) HW / HW — / SW HW / SW V4L2, SW HEVC/JPEG Dec
Raspberry Pi 5 Model B (Debian 13, Linux 6.18) — / SW — / SW SW / SW SW Codecs
Rockchip RK3566 (Radxa ZERO 3, Debian 12) — / HW — / HW SW / SW V4L2 / RKMPP, SW JPEG

Legend: HW — hardware-accelerated codec, SW — software codec, — — not supported (no software H.264/HEVC encoder).

Encoding / Decoding time, ms

Platform Codec 1080p Enc (ms) 1080p Dec (ms) 720p Enc (ms) 720p Dec (ms)
Windows 11 x64 (i7-13700H, RTX 4050) H.264 3.1 (HW) 7.6 (HW) 1.7 (HW) 7.6 (HW)
H.265 3.8 (HW) 11.6 (HW) 2.1 (HW) 9.5 (HW)
JPEG 6.4 (SW) 5.3 (SW) 2.8 (SW) 2.5 (SW)
Linux x86-64 (Ubuntu 24.04 WSL 2, RTX 4050) H.264 3.5 (HW) 2.8 (HW) 1.9 (HW) 1.7 (HW)
H.265 4.1 (HW) 2.0 (HW) 2.3 (HW) 1.2 (HW)
JPEG 1.3 (SW) 1.6 (HW) 0.6 (SW) 0.8 (HW)
Linux x86-64 (SW only) (i7-13700H, 1 thread) H.264 — 1.8 (SW) — 0.9 (SW)
H.265 — 4.0 (SW) — 1.8 (SW)
JPEG 1.4 (SW) 1.2 (SW) 0.6 (SW) 0.6 (SW)
Intel Atom x7835RE (SECO E08, Ubuntu 24.04) H.264 5.6 (HW) 3.8 (HW) 3.1 (HW) 1.8 (HW)
H.265 8.2 (HW) 3.3 (HW) 4.3 (HW) 1.6 (HW)
JPEG 3.0 (HW) 3.6 (HW) 1.3 (HW) 1.6 (HW)
NVIDIA Jetson Orin NX (Jetson Linux R36.4.7)* H.264 21.2 / 5.1* (HW) 19.6 / 5.4* (HW) 10.9 / 2.5* (HW) 10.9 / 3.3* (HW)
H.265 21.5 / 4.8* (HW) 14.5 / 4.1* (HW) 10.6 / 2.5* (HW) 7.4 / 2.2* (HW)
JPEG 19.2 (SW) 2.5 (SW) 8.5 (SW) 1.2 (SW)
NVIDIA Jetson Nano (Jetson Linux R32.7.1) H.264 8.0 (HW) 10.6 (HW) 4.0 (HW) 5.0 (HW)
H.265 8.7 (HW) 8.8 (HW) 4.3 (HW) 4.8 (HW)
JPEG 56.8 (SW) 7.2 (SW) 24.9 (SW) 3.6 (SW)
NXP i.MX95 (Toradex SMARC, Linux 6.6) H.264 4.0 (HW) 21.7 (HW) 2.0 (HW) 10.5 (HW)
H.265 3.8 (HW) 22.0 (HW) 2.0 (HW) 10.5 (HW)
JPEG 13.4** (HW) 25.6 (HW) 6.0** (HW) 11.5 (HW)
NXP i.MX8M Plus (Toradex SMARC, Linux 6.6) H.264 7.5 (HW) 62.1 (SW) 3.9 (HW) 28.0 (SW)
H.265 6.9 (HW) 41.6 (SW) 3.7 (HW) 18.4 (SW)
JPEG 111.6 (SW) 10.7 (SW) 48.9 (SW) 5.6 (SW)
Raspberry Pi 4 Model B (Debian 12, Linux 6.12) H.264 22.1 (HW) 29.6 (HW) 13.7 (HW) 14.9 (HW)
H.265 — 20.6 (SW) — 9.3 (SW)
JPEG 21.7 (HW) 6.5 (SW) 11.3 (HW) 3.3 (SW)
Raspberry Pi 5 Model B (Debian 13, Linux 6.18) H.264 — 15.8 (SW) — 6.6 (SW)
H.265 — 10.0 (SW) — 4.3 (SW)
JPEG 29.3 (SW) 2.8 (SW) 12.8 (SW) 1.4 (SW)
Rockchip RK3566 (Radxa ZERO 3, Debian 12) H.264 — 5.9 (HW) — 4.1 (HW)
H.265 — 5.7 (HW) — 3.5 (HW)
JPEG 93.6 (SW) 9.6 (SW) 40.1 (SW) 4.8 (SW)

Notes: - HW — hardware-accelerated codec, SW — software codec (1 thread), — — not supported. - Average per-frame encoding/decoding time over 100 frames (NV12, 5000 kbps, 30 fps, GOP 30, JPEG quality 80). - * Jetson Orin NX: values marked with * show frame times with video engine clocks locked at maximum frequency. - ** NXP i.MX95: median JPEG encoding time.

Documentation

Documentation: GO TO DOCUMENTATION

Simple interface

class VCodecUniversal : public VCodec
{
public:

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

    /// Class constructor.
    VCodecUniversal();

    /// Class destructor.
    ~VCodecUniversal() override;

    /// Copy and move operations are deleted.
    VCodecUniversal(const VCodecUniversal&) = delete;
    VCodecUniversal(VCodecUniversal&&) = delete;
    VCodecUniversal& operator=(const VCodecUniversal&) = delete;
    VCodecUniversal& operator=(VCodecUniversal&&) = delete;

    /// Transcode (encode or decode) video frame.
    bool transcode(Frame& src, Frame& dst) override;

    /// Set parameter value.
    bool setParam(VCodecParam id, float value) override;

    /// Get parameter value.
    float getParam(VCodecParam id) override;

    /// Execute command.
    bool executeCommand(VCodecCommand id) override;
};

Simple example

#include <cstdint>
#include <fstream>
#include <iostream>
#include "VCodecUniversal.h"

int main()
{
    // One codec for encoding and decoding. It selects the hardware codec of
    // the computer itself, or a software codec if there is no hardware codec.
    rapidpixel::VCodecUniversal codec;
    codec.setParam(rapidpixel::VCodecParam::BITRATE_KBPS, 5000.0f);
    codec.setParam(rapidpixel::VCodecParam::FPS, 30.0f);

    // Frames: source image, compressed data (H264, HEVC or JPEG) and decoded
    // image.
    rapidpixel::Frame image(1280, 720, rapidpixel::Fourcc::NV12);
    rapidpixel::Frame compressed(1280, 720, rapidpixel::Fourcc::H264);
    rapidpixel::Frame decoded(1280, 720, rapidpixel::Fourcc::NV12);

    std::ofstream file("out.h264", std::ios::binary);
    for (int n = 0; n < 100; ++n)
    {
        // Put your image here. The example draws moving stripes.
        for (int i = 0; i < image.size; ++i)
            image.data[i] = static_cast<uint8_t>(i + n);

        // Encode: NV12 -> H264.
        if (!codec.transcode(image, compressed))
        {
            std::cout << "No H264 encoder on this computer" << std::endl;
            return 1;
        }
        file.write(reinterpret_cast<char*>(compressed.data), compressed.size);

        // Decode: H264 -> NV12. The size is 0 if the encoder holds the image.
        if (compressed.size > 0 && codec.transcode(compressed, decoded))
        {
            std::cout << "Frame " << n << ": " << compressed.size
                      << " bytes -> " << decoded.width << "x"
                      << decoded.height << std::endl;
        }
    }
    return 0;
}