-1

I am using below list of version.

opencv-4.2.0, Gstreamer-1.20.2, python 3.7, windows 10.

I want to play video using Gstreamer rtsp camera.why this gst-pipeline it's not run on vscode python but these gst-pipeline perfectly run on cmd.

Pipeline:----

rtspsrc location=rtsp://... ! rtph264depay ! queue ! h264parse ! d3d11h264dec ! d3d11convert ! video/x-raw(memory:D3D11Memory), format=(string)NV12 ! appsink

The error i am getting is as follows:-

[ WARN:0] global opencv-4.2.0\modules\videoio\src\cap_gstreamer.cpp (1759) cv::handleMessage OpenCV | GStreamer warning: Embedded video playback halted; module udpsrc1 reported: Internal data stream error.

[ WARN:0] global opencv-4.2.0\modules\videoio\src\cap_gstreamer.cpp (888) cv::GStreamerCapture::open OpenCV | GStreamer warning: unable to start pipeline

[ WARN:0] global opencv-4.2.0\modules\videoio\src\cap_gstreamer.cpp (480) cv::GStreamerCapture::isPipelinePlaying OpenCV | GStreamer warning: GStreamer: pipeline have not been created

Can you please let me know.How to solve this issue??

AD Thumar
  • 1
  • 3

1 Answers1

0

You may try adding caps after udpsrc:

rtspsrc location=rtsp://... ! application/x-rtp,encoding-name=H264 ! rtph264depay ! ...

This was a stupid advice. Specifying these caps make sense with udpsrc, but are not required for rtspsrc.

Re-reading it now, the issue is probably the memory space. Opencv may only expect system memory for now, so you may try:

rtspsrc location=rtsp://... ! rtph264depay ! queue ! h264parse ! d3d11h264dec ! d3d11convert ! video/x-raw ! videoconvert ! video/x-raw, format=BGR ! appsink drop=1

Here converting to BGR as most opencv color algorithms expect, but if you intend to process NV12 frames, just change format (not sure videoconvert is required, but if not the overhead may be low).

SeB
  • 1,159
  • 6
  • 17
  • sir it's not working. any other solution to solve this problem. plz reply me – AD Thumar Sep 12 '22 at 03:59
  • [ WARN:0@0.405] global C:\opencv-4.6.0\modules\videoio\src\cap_gstreamer.cpp (2402) cv::handleMessage OpenCV | GStreamer warning: Embedded video playback halted; module udpsrc0 reported: Internal data stream error. [ WARN:0@0.421] global C:\opencv-4.6.0\modules\videoio\src\cap_gstreamer.cpp (1356) cv::GStreamerCapture::open OpenCV | GStreamer warning: unable to start pipeline [ WARN:0@0.421] global C:\opencv-4.6.0\modules\videoio\src\cap_gstreamer.cpp (862) cv::GStreamerCapture::isPipelinePlaying OpenCV | GStreamer warning: GStreamer: pipeline have not been created – AD Thumar Sep 12 '22 at 04:00
  • it's not working.opencv system memory transfer on gpu or not – AD Thumar Sep 13 '22 at 03:55
  • The error is :- (python.exe:14612): GStreamer-CRITICAL **: 09:25:15.185: gst_structure_set: assertion 'IS_MUTABLE (structure) || field == NULL' failed – AD Thumar Sep 13 '22 at 03:55
  • I have to only rtsp camera to read frame on gpu and save so what type of requierment fullfil and what type of process to execute. – AD Thumar Sep 13 '22 at 04:43