ros_rtsp
ros_rtsp copied to clipboard
Inter-client Connection Dependency
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:
- Install this ros node exactly following your readme
- 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
- 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
- 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
- Restart this ROS node
- 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
- Stop running
gst-launch-1.0
- 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?
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
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 @zoombinis I have the same issue , have you solved this issue?
Not yet unfortunately...
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.
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!
I get the same error on ubuntu 18.04, and solve it by
sudo apt install gstreamer1.0-libav
@MCFurry I am having the exact same issue trying to connect to a Siemens HMI. Did you manage to find a solution?
XD
I never solved this unfortunately...