APP Crashed, pull stream by opencv videocapure

My app crashed if pulling stream from network cameras by following url, and the camera set h264 decoder.

std::string url = "rtsp://192.168.1.12:554/h265/ch1/main/av_stream ! rtph265depay ! h265parse ! nvv4l2decoder ! nvvidconv ! video/x-raw,width=1280,height=720,format=BGRx ! videoconvert ! video/x-raw,format=BGR !appsink sync=false

And, it also crashed if the network camera set h265 decoder by following url.

std::string url = "rtsp://192.168.1.12:554/h264/ch1/main/av_stream ! rtph264depay ! h264parse ! nvv4l2decoder ! nvvidconv ! video/x-raw,width=1280,height=720,format=BGRx ! videoconvert ! video/x-raw,format=BGR !appsink sync=false

Why crashed, but could not pull stream?

Hi,
Please try to launch the string in gst-launch-1.0 and check if it works:

gst-launch-1.0 rtsp://192.168.1.12:554/h265/ch1/main/av_stream ! rtph265depay ! h265parse ! nvv4l2decoder ! nvvidconv ! video/x-raw,width=1280,height=720,format=BGRx ! videoconvert ! video/x-raw,format=BGR ! fakesink sync=false

If it works in gst-launch-1.0 command with fakesink, generally it should work in cv2.VideoCapture() with appsink.

Obvously, it works, but my question is, why app crashed by rtph265depay when pulling h264 stream?

Hi,
Do you mean you are not able to know if the source is h264 or h265 in some cases? In this condition, suggest use uridecodebin to select the plugins automatically. For further information, you can print out the selected plugins by setting:

$ export GST_DEBUG=*FACTORY*:4
1 Like

I has multple threads to open and close multiple network camera connections repeatedly, but I got following crash with above url. Could you help find reasons?

Inconsistency detected by ld.so: dl-tls.c: 481: _dl_allocate_tls_init: Assertion `listp->slotinfo[cnt].gen <= GL(dl_tls_generation)’ failed!