Hardware-accelerated JPEG Encoding in DeepStream Plugin - NPP + NvJPEG Encoder Integration for Zero CPU Transfers

Please provide complete information as applicable to your setup.

• Hardware Platform (Jetson)
• DeepStream 6.2
• JetPack Version (Version: 5.1.1-b56)
• Issue Type( questions,)
• Requirement details( This is for new requirement)

Problem Description:

I’m developing a custom GStreamer plugin for DeepStream that needs to save processed JPEG images from video frames. Currently using an inefficient CPU-based approach (which works fine) and seeking to implement a fully GPU-accelerated pipeline to eliminate all GPU↔CPU transfer bottlenecks.

Current Approach:

NvBufSurface (GPU) → CPU Memory → cv::Mat → OpenCV Operations → cv::imwrite → JPEG File
↑____________ GPU→CPU Transfer Bottleneck ____________↑

New Approach: NPP +NvJPEG Encoder Integration :

NvBufSurface (GPU) → NPP Operations (GPU) → NvJpegEncoder (GPU) → JPEG File
↑___________ All GPU, Zero CPU Transfers ___________↑

I’m planning to replace OpenCV operations with NPP (NVIDIA Performance Primitives) to perform all image processing operations (drawing, resizing, color space conversions, etc.) directly on NvBufSurface GPU data, then use NvJPEGEncoder to save the processed results to JPEG files.

Reference:

Following 05_jpeg_encode sample documentation for JPEG encoding implementation.

Progress So Far:

✅ Successfully saved some JPEG images for few frames from NvBufSurface using NvJPEGEncoder

❌ Application crashes after saving a few images.

🎯 Yet to resolve the crash and integrate NPP operations before JPEG encoding.

Specific Questions:

  1. Is NPP + NvJPEGEncoder integration viable and recommended for DeepStream plugins?

  2. Performance vs Memory: Would this provide significant memory utilization improvements? (Current application works fine, just want to optimize memory usage)

  3. Memory Management: Are there specific considerations when chaining NPP operations with NvJPEGEncoder in GStreamer plugin context?

  4. Stability: Will there be crashes when chaining NPP operations with NvJPEGEncoder? Any known pitfalls?

Alternative Approaches:

If this approach isn’t optimal, what other GPU-only methods would minimize CPU↔GPU transfers for image processing + JPEG encoding in DeepStream?

Any guidance on NvBufSurface-NPP-NvJPEGEncoder workflows or alternative GPU-only approaches would be appreciated.

We haven’t used the NPP+NvJPEG in DeepStream before. We are not sure if there are any pitfalls in this way. You can attach your source code and we can analyze the crash issue too.
At present, we only have the API for C/C++ that can use the hardware to encode the JPEG image. You can refer to our source code deepstream\sources\apps\sample_apps\deepstream-image-meta-test.

Apologies for the typo in jetpack version.

My jetpack version is 5.1.1-b56 and not 5.11.

I am facing the error mentioned here when running this example.

Are there any solutions to run this sample application without updating the jetpack version ?

No. We suggest that you follow our Jetson model Platform and OS Compatibility to match the versions.

There is no update from you for a period, assuming this is not an issue anymore. Hence we are closing this topic. If need further support, please open a new one. Thanks.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.