Nvjpegenc does not work with opencv

Hi there ,

I working on a Jetson Nano on a real time stream jpeg images .
I want to work with accelerated encoder (nvjpegenc). I have created a pipeline with gstreamer and works fine in the commant line :

gst-launch-1.0 videomixer name=m sink_1::ypos=600 ! videoconvert ! nvjpegenc ! rtpjpegpay ! udpsink host= port=5600 v4l2src device=/dev/video3 ! image/jpeg, width=800, height=600 ! jpegdec ! queue ! videoconvert ! m. v4l2src device=/dev/video2 ! image/jpeg, width=800, height=600 ! jpegdec ! queue ! videoconvert ! m.

I tried to write that pipeline on opencv VideoWriter but it works only with jpegenc and not with nvjpegenc. I passed the frame as Mat .

writer1.open(“appsrc ! autovideoconvert ! video/x-raw,format=I420 ! jpegenc ! rtpjpegpay ! udpsink host= port=5600”,cv::VideoWriter::fourcc(‘M’,‘J’,‘P’,‘G’),28,Size(width , height * 2 ),true);

When that VideoWriter is initiate with the pipeline with nvjpegenc i receive the following error.
(Argus) Error EndOfFile: Unexpected error in reading socket (in src/rpc/socket/client/ClientSocketManager.cpp, function recvThreadCore(), line 266)
(Argus) Error EndOfFile: Receive worker failure, notifying 1 waiting threads (in src/rpc/socket/client/ClientSocketManager.cpp, function recvThreadCore(), line 340)
(Argus) Error InvalidState: Argus client is exiting with 1 outstanding client threads (in src/rpc/socket/client/ClientSocketManager.cpp, function recvThreadCore(), line 357)
(Argus) Error EndOfFile: Receiving thread terminated with error (in src/rpc/socket/client/ClientSocketManager.cpp, function recvThreadWrapper(), line 368)
(Argus) Error EndOfFile: Client thread received an error from socket (in src/rpc/socket/client/ClientSocketManager.cpp, function send(), line 145)
(Argus) Error EndOfFile: (propagating from src/rpc/socket/client/SocketClientDispatch.cpp, function dispatch(), line 87)
WARNING Argus: 10 client objects still exist during shutdown:
547347949624 (0x7f60003768)
547356057328 (0x7f60001750)
547356057488 (0x7f600017f0)
547356062880 (0x7f60001950)
547356064176 (0x7f60003650)
547368303328 (0x7f38000bf0)
547368303488 (0x7f38000c90)
547368306176 (0x7f38000df0)
547368306400 (0x7f38002100)
547368314376 (0x7f38002218)

Do I have to add something on my pipeline created on opencv ?

We don’t support this case. Please refer to explanation in
OpenCV with libnvjpeg - #5 by DaneLLL