VCodecJetPack C++ library v2.0.0

Low-latency video encoding and decoding library for H264, HEVC(H265) and JPEG codecs based on Nvidia JetPack Multimedia API.

Overview

VCodecJetPack C++ library provides hardware video encoding for H264, HEVC codecs for Jetson platforms. VCodecJetPack class inherits interface and data structures from open source VCodec library and also includes Logger open source library. VCodecJetPack uses Jetson Multimedia API. The library provides simple programming interface to be implemented in different C++ projects. The library was written with C++17 standard. The libraries are supplied as source code only. The library is a CMake project.

class VCodecJetPack : public VCodec {
public:
    /// Encode video frame.
    bool transcode(Frame& src, Frame& dst);
    /// Set parameter value.
    bool setParam(VCodecParam id, float value);
    /// Get parameter value.
    float getParam(VCodecParam id);
    /// Execute command.
    bool executeCommand(VCodecCommand id);
};

How to use

Source code bellow is simple application which encodes video frames (NV12 pixel format, pseudo code used) by H264 codec and writes results to file:

#include "VCodecJetPack.h"
using namespace cr::video;

int main(void) {
    // Create codec object and set parameters.
    VCodecJetPack codec;
    codec.setParam(VCodecParam::BITRATE_KBPS, 2500);
    codec.setParam(VCodecParam::GOP, 30);
    codec.setParam(VCodecParam::FPS, 30);
    // Create input NV12 and output H264 frames.
    Frame dstH264; dstH264.fourcc = Fourcc::H264;
    Frame srcNv12;
    // Create output file.
    FILE *out = fopen("out.h264", "w+b");
    // Encode and record 200 frames.
    for (int n = 0; n < 200; ++n) {
        // Get NV12 frame pseudo code.
        srcNv12 = getNextFrame();
        // Encode.
        if (!codec.transcode(srcNv12, dstH264))
            continue;
        // Write to file.
        fwrite(dstH264.data, dstH264.size, 1, out);
    }
    // Close file.
    fclose(outputFile);
    return 1;
}

Price and Terms

The VCodecJetPack C++ library is supplied under a license in source code. Library pricing is available upon request info@constantrobotics.com

Downloads

VSourceJetPack C++ library programmer’s manual: DOWNLOAD