How to use nvv4l2h264enc for opencv udpsink?

Please provide complete information as applicable to your setup.

• Hardware Platform: T4
• NVIDIA GPU Driver Version:450.80
• Issue Type:questions

Hi NVs,

I am using nvv4l2h264enc in gstreamer pipeline for opencv udpsink, but I cant run it succeed. Can you help me fix it? Thanks!

I have tested the rtsp function in jetson, and it can run succeed, the pipeline is below.

    output = cv2.VideoWriter('appsrc is-live=true ! videoconvert ! omxh264enc bitrate=12000000 ! video/x-h264, \
        stream-format=byte-stream ! rtph264pay pt=96 ! udpsink host=127.0.0.1 port=5401 async=false',cv2.CAP_GSTREAMER,0, fps, (width,height), True)

As far as my know, we should use nvv4l2h264enc element rather than omxh264enc in dGPU, so I test pipeline below but run failed.

    output = cv2.VideoWriter('appsrc is-live=true  ! videoconvert ! video/x-raw,format=I420 ! nvvideoconvert ! video/x-raw(memory:NVMM) ! nvv4l2h264enc ! h264parse ! rtph264pay pt=96 ! udpsink host=127.0.0.1 port=5401',cv2.CAP_GSTREAMER, 0, fps, (width,height), True)

    if not output.isOpened():
        print('VideoWriter not opened')
        exit(0)

But I can test pipeline succeed

gst-launch-1.0 appsrc ! video/x-raw,width=1920,height=1080,format=BGR ! videoconvert ! video/x-raw,format=I420 ! nvvideoconvert ! 'video/x-raw(memory:NVMM)' ! nvv4l2h264enc ! h264parse ! rtph264pay pt=96 ! udpsink host=127.0.0.1 port=5401

gst-launch-1.0 videotestsrc ! video/x-raw,width=1920,height=1080,format=BGR ! videoconvert ! video/x-raw,format=I420 ! nvvideoconvert ! 'video/x-raw(memory:NVMM)' ! nvv4l2h264enc ! h264parse ! matroskamux ! fakesink

Can you give me some advices? Thanks!

Hello, any help?

Sorry for the late response, we will investigate this issue and have update soon.

hello, any update? thanks!

If the gst-launch pipeline can work, there is no problem with deepstream plugins. You may need to check with opencv. We will try your case when we have resource.

Hi, thanks for your response.

I know there is no problem in deepstream plugin, the problem is how to use it with opencv. It is great if you can check it and give some useful examples.

Thanks.