ros_rtsp icon indicating copy to clipboard operation
ros_rtsp copied to clipboard

Inter-client Connection Dependency

Open ghost opened this issue 4 years ago • 10 comments

I am seeing a strange and repeatable behavior, where if I install this ros node in a docker container running melodic, a totally separate machine, also running melodic, is only able to consume the stream after I have first consumed it locally from within the stream using a gst-launch-1.0 client. If I do not first run the gst-launch-1.0 client, the other client can never successfully connect.

Steps:

  1. Install this ros node exactly following your readme
  2. run with the following config:
port: "8554"
streams:
  mock-stream:
    type: topic
    source: /zed/zed_nodelet/left/image_rect_color
    mountpoint: /mock
    caps: video/x-raw,framerate=10/1,width=1280,height=720
    bitrate: 500
  1. Try to consume from another machine using python (or even VLC) but get error:
capture = cv2.VideoCapture(rtsp_url, cv2.CAP_FFMPEG)

503 Service Not Available

  1. On host, this ros node prints error:

0:00:21.117989831 1454 0x5623304bba80 ERROR GST_PIPELINE grammar.y:816:priv_gst_parse_yyparse: no element "x264enc" 0:00:21.118087772 1454 0x5623304bba80 ERROR GST_PIPELINE grammar.y:901:priv_gst_parse_yyparse: link has no sink [source=@0x7f0e3801dcd0] 0:00:21.124276372 1454 0x5623304bba80 ERROR GST_PIPELINE grammar.y:901:priv_gst_parse_yyparse: link has no source [sink=@0x7f0e38030240] 0:00:21.314472980 1454 0x5623304bba80 ERROR rtspclient rtsp-client.c:1054:find_media: client 0x7f0e4c00b0f0: can't prepare media 0:00:21.314845959 1454 0x5623304bba80 ERROR rtspclient rtsp-client.c:2910:handle_describe_request: client 0x7f0e4c00b0f0: no media

  1. Restart this ROS node
  2. From within the same container (local), run: gst-launch-1.0 -v rtspsrc location=rtsp://0.0.0.0:8554/mock drop-on-latency=true use-pipeline-clock=true do-retransmission=false latency=0 protocols=GST_RTSP_LOWER_TRANS_UDP ! rtph264depay ! h264parse ! avdec_h264 ! autovideosink sync=true
  3. Stop running gst-launch-1.0
  4. Again run my python code and it works

So how is the local gst-launch-1.0 client enabling the python (opencv) client to connect correctly? Shouldn't clients not depend on each other?

ghost avatar Feb 08 '21 16:02 ghost

Sorry for the late reply and thanks for all your efforts trying to debug. When it gets too deep into gstreamer it goes over my head.

Can i suggest checking on the remote machine using gstreamer from the terminal? This should allow you access to the stream without consuming locally first.

gst-launch-1.0 -v rtspsrc location=rtsp://<server_ip>:8554/<your_stream_mountpoint> drop-on-latency=true use-pipeline-clock=true do-retransmission=false latency=0 protocols=GST_RTSP_LOWER_TRANS_UDP ! rtph264depay ! h264parse ! avdec_h264 ! autovideosink sync=true

CircusMonkey avatar Apr 13 '21 03:04 CircusMonkey

I seem to have a similar issue. I have an HMI connecting to the RTSP stream, but the ROS node shows similar errors: 0:00:21.314472980 1454 0x5623304bba80 ERROR rtspclient rtsp-client.c:1054:find_media: client 0x7f0e4c00b0f0: can't prepare media 0:00:21.314845959 1454 0x5623304bba80 ERROR rtspclient rtsp-client.c:2910:handle_describe_request: client 0x7f0e4c00b0f0: no media

When I then open vlc as well on a remote computer, vlc throws an error about not being able to connect to the stream, but now the stream on the HMI starts to show! vlc however is not able to show the stream.

If vlc is the only one and first one to connect, it shows the stream, but it is stuck on the first frame received?

MCFurry avatar Jul 20 '21 08:07 MCFurry

@MCFurry @zoombinis I have the same issue , have you solved this issue? image

yuqizhi avatar Aug 06 '21 02:08 yuqizhi

Not yet unfortunately...

MCFurry avatar Aug 06 '21 06:08 MCFurry

Not the solution to your problem, just a little extra info. OpenCV doesn't seem to support the UDP transport protocol which we are using here. Only TCP. Info found here: https://github.com/opencv/opencv/issues/8478

I do not want to switch to TCP because the whole point of this is lowest latency.

CircusMonkey avatar Aug 06 '21 08:08 CircusMonkey

Also I am very inactive on this project to the point that I no longer have a ros machine with a webcam. I will however respond when I can and merge branches if people find solutions. Good luck!

CircusMonkey avatar Aug 06 '21 08:08 CircusMonkey

I get the same error on ubuntu 18.04, and solve it by sudo apt install gstreamer1.0-libav

armme41 avatar Aug 17 '21 02:08 armme41

@MCFurry I am having the exact same issue trying to connect to a Siemens HMI. Did you manage to find a solution?

magnipopam avatar Apr 01 '22 20:04 magnipopam

XD

Jairo-Roke avatar Feb 28 '24 22:02 Jairo-Roke

I never solved this unfortunately...

MCFurry avatar Feb 29 '24 06:02 MCFurry