Can't use gstreamer's nvjpegenc and opencv at the time

Hi,

In Xavier, I can use gstreamer’s nvjpegenc as below without any problem.

gst_parse_launch(" some thing .... ! nvjpegenc ! ..."

I can use use VPI interface without any problem, like

vpiSubmitConvertImageFormat(stream, backend, imageBGRA, imageBGR, NULL);

But I can’t use them at the same time, I mean in the same application, compiled, linked together, the error message is:

JPEG parameter struct mismatch: library thinks size is 584, caller expects 728

then the application exits.

to avoid this error, I have to disable either one of them.

It’s similar to this issue, but that one is nvjpegenc & opencv (opencv is not suppored by nvidia), my issue is nvjpegenc and VPI, both are from nvidia.

You may try using LD_PRELOAD so that libnvjpeg is found before libjpeg:

LD_PRELOAD=/usr/lib/aarch64-linux-gnu/tegra/libnvjpeg.so ./your_app

If not working, a workaround would be to split the application into 2 processes, one using nvjpeg lib for encoding with nvjpegenc, and another one reading for using opencv or VPI such as:

Sender

gst-launch-1.0 videotestsrc ! nvvidconv ! 'video/x-raw(memory:NVMM),format=I420' ! nvjpegenc ! image/jpeg,format=MJPG ! shmsink socket-path=jpg.sock

Receiver

gst-launch-1.0 shmsrc socket-path=jpg.sock ! jpegdec ! xvimagesink

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