Ask Your Question
0

how can use gstreamer with rtsp stream

asked Aug 2 '18

kishan patel gravatar image

Hello, I have found that gstreamer can be use to play video frame from web-cam as below:

VideoCapture cap("v4l2src ! video/x-raw,format=BGR,width=640,height=480,framerate=30/1 ! appsink",CAP_GSTREAMER);

Now, i have tried to make some changes to read video frame for "rtsp" stream,but i got some errors. Can anyone modify above line to use "rtsp" stream instead of camera-device '0'.

Regards, Kishan Patel.

Preview: (hide)

1 answer

Sort by » oldest newest most voted
0

answered Aug 11 '18

kishan patel gravatar image

Hello, When i play rtsp video stream using command line, its working fine.But with VideoCapture function of OpenCV,it could not. Please check the below command:


gst-launch-1.0 -v rtspsrc location="rtsp://admin:admin@192.168.1.2:554" latency=10 ! rtph264depay ! h264parse ! ducatih264dec ! videoconvert ! waylandsink ---------------------(WORKING FINE)


cv::VideoCapture cap("rtspsrc location=\"rtsp://admin:admin@192.168.1.2:554\" latency=10 ! rtph264depay ! h264parse ! ducatih264dec ! videoconvert ! appsink "); ----------------------(Not Working).

Error log as below:

(play_rtsp_stream:5304): GStreamer-CRITICAL **: gst_element_get_static_pad: assertion 'GST_IS_ELEMENT (element)' failed

(play_rtsp_stream:5304): GStreamer-CRITICAL **: gst_pad_get_current_caps: assertion 'GST_IS_PAD (pad)' failed

(play_rtsp_stream:5304): GStreamer-CRITICAL **: gst_caps_get_structure: assertion 'GST_IS_CAPS (caps)' failed

(play_rtsp_stream:5304): GStreamer-CRITICAL **: gst_structure_get_int: assertion 'structure != NULL' failed

(play_rtsp_stream:5304): GStreamer-CRITICAL **: gst_structure_get_int: assertion 'structure != NULL' failed

(play_rtsp_stream:5304): GStreamer-CRITICAL **: gst_structure_get_fraction: assertion 'structure != NULL' failed GStreamer Plugin: Embedded video playback halted; module udpsrc8 reported: Internal data stream error. OpenCV Error: Unspecified error (GStreamer: unable to start pipeline ) in icvStartPipeline, file /oe/bld/build-CORTEX_1/arago-tmp-external-linaro-toolchain/work/am57xx_evm-linux-gnueabi/opencv/3.1+gitAUTOINC+9b88e8c746-r3/git/modules/videoio/src/cap_gstreamer.cpp, line 393 terminate called after throwing an instance of 'cv::Exception' what(): /oe/bld/build-CORTEX_1/arago-tmp-external-linaro-toolchain/work/am57xx_evm-linux-gnueabi/opencv/3.1+gitAUTOINC+9b88e8c746-r3/git/modules/videoio/src/cap_gstreamer.cpp:393: error: (-2) GStreamer: unable to start pipeline in function icvStartPipeline

Aborted (core dumped)

What should i make changes in this function?.

Regards,

Kishan Patel

Preview: (hide)

Comments

please do not post answers, if you have a question or comment .

instead -- please EDIT your question

berak gravatar imageberak (Aug 11 '18)edit

Okay. Actually, there is limit of characters in comments,thats why i put it here. And Can anyone know about this issue? Please guide me how can i resolve this issue.

kishan patel gravatar imagekishan patel (Aug 11 '18)edit

Question Tools

1 follower

Stats

Asked: Aug 2 '18

Seen: 4,676 times

Last updated: Aug 11 '18