Deepstream seems to have broken opencv videowriter?

Hello, before installing deepstream I was running a script which successfully operated on an image using VPI then sent it to an endpoint

def gstreamer_pipeline_out_mod():
    return (
        "appsrc ! "
        "videoconvert ! "
        "video/x-raw, framerate=(fraction)25/1, format=RGBA ! "
        "nvvidconv ! "
        "nvv4l2h264enc ! "
        "h264parse ! "
        "flvmux ! "
        "queue leaky=downstream ! "
        "rtmpsink location=rtmp:// sync=false")

   out_stream = cv2.VideoWriter(
        frameSize=(1920, 1080))

        with time_it("output from CPU to mux"):
            # lock GPU memory to pull out buffer
            with frame1.rlock_cpu() as data:

this works well - now after installing DeepStream the script appears to work fine but the NVENC chip does not activate and nothing is sent to our end point. If I use gstreamer CLI commands to send a test-image to the same endpoint it works as expected… Any ideas?

the following test command works fine

gst-launch-1.0 videotestsrc ! video/x-raw ! nvvidconv ! nvv4l2h264enc maxperf-enable=1 ! h264parse ! flvmux streamable=true ! queue ! rtmpsink location='rtmp://' 

ok just in case this helps anyone else

when I used print(cv2.getBuildInformation()) I could see that gstreamer was NOT in the build this time - no idea why that started happening. So the cv2.videowriter was failing silently, or just not doing anything

Anyway, I built opencv with gstreamer following this guide How to compile OpenCV with Gstreamer [Ubuntu&Windows] | by Galaktyk 01 | Medium

then you have to make sure the correct opencv is being loaded by python again with getbuildinformation

if you still don’t have gstreamer, try to uninstall using

python3 -m pip uninstall opencv-python

1 Like

Sorry for the late response, and glad to see you have solved the issue already.

1 Like

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