I decode with opencv and gstreamer plugin "nvv4l2decoder", the program is stuck at cap.read()

Please provide complete information as applicable to your setup.

• Hardware Platform (Jetson / GPU) Jetson
• DeepStream Version 5.1
• JetPack Version (valid for Jetson only) 4.6
• TensorRT Version 8.0
• NVIDIA GPU Driver Version (valid for GPU only)
• Issue Type( questions, new requirements, bugs)
• How to reproduce the issue ? (This is for bugs. Including which sample app is using, the configuration files content, the command line used and other details for reproducing)
• Requirement details( This is for new requirement. Including the module name-for which plugin or for which sample application, the function description)

I decode with the below command

VideoCapture cap("filesrc location=sample_1080p_h265.mp4 ! qtdemux ! queue ! h265parse ! nvv4l2decoder ! nvvidconv flip-method=0 ! video/x-raw,format=(string)BGRx ! videoconvert ! video/x-raw,format=(string)BGR ! appsink sync=false");

    Mat frame,sframe;
    float scale = 0.5;
    while(true)
    {
        cap>>frame;
        resize(frame,sframe,cv::Size(0,0),scale,scale);
        imshow("pic",sframe);
        if(waitKey(1)==27)
            break;
    }

    cap.release();

But the program is probabilistic stuck “cap>>frame”.

How did this happen?Is it because cpu is busy?
And how to void this problem ?

You can try to run the command below first and check if it’s stuck.

gst-launch-1.0 filesrc location=sample_1080p_h265.mp4 ! qtdemux ! queue ! h265parse ! nvv4l2decoder ! nvvidconv flip-method=0 ! video/x-raw,format=(string)BGRx ! videoconvert ! video/x-raw,format=(string)BGR ! appsink sync=false

Thanks for reply.I think it is ok. Because when I decode one video ,it is ok in my program.

But when I use multi thread to decode multi videos and infer, the problem is bound to arise.

Is it because of the version of tensorrt and deepstream is not suitable.

No. From your description, it could be a problem with your OpenCV code. You can run the tegrastats to check the loading of your board. If there is no problem with the loading, it should be a problem with your OpenCV code.
We don’t have a lot of experience with OpenCV. You can check the relevant problems yourself.

Thanks. Is there some good suggestion for multiple video hardware decoding.

No. This is limited by your hardware capabilities. If the loading of the hardware is too heavy, you can consider using software decoder to decode some videos.

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.