Open Amit10311 opened 1 month ago
Debugging tips:
export GST_DEBUG="*:3"
ros2 run gscam gscam_node --ros-args --log-level DEBUG
What errors are you seeing? What's the behavior?
Another note, that I think could be a problem - if you don't set gstreamer to log errors, it could quietly have pipeline problems. For instance, I had this one:
0:00:00.008466552 587282 0x70a4cc1b7e30 WARN structure gststructure.c:2288:priv_gst_structure_parse_name: Failed to parse structure string ''application/x-rtp, sampling=(string)YCbCr-4:2:2, width=(string)640, height=(string)480''
0:00:00.008482453 587282 0x70a4cc1b7e30 ERROR GST_PIPELINE gst/parse/grammar.y:453:gst_parse_element_set: could not set property "caps" in element "udpsrc0" to "'application/x-rtp, sampling=(string)YCbCr-4:2:2, width=(string)640, height=(string)480'"
[ERROR] [1715286998.693376586] [gscam_publisher]: Gstreamer errors after pipeline: 4could not set property "caps" in element "udpsrc0" to "'application/x-rtp, sampling=(string)YCbCr-4:2:2, width=(string)640, height=(string)480'"
...
[DEBUG] [1715286998.696153169] [rcl]: Publisher initialized
[INFO] [1715286998.696462436] [gscam_publisher]: Publishing stream...
[INFO] [1715286998.696548809] [gscam_publisher]: Started stream.
0:00:00.013528939 587282 0x70a4cc007c60 WARN rtpbasedepayload gstrtpbasedepayload.c:815:gst_rtp_base_depayload_handle_buffer:<rtpvrawdepay0> error: No RTP format was negotiated.
0:00:00.013538828 587282 0x70a4cc007c60 WARN rtpbasedepayload gstrtpbasedepayload.c:815:gst_rtp_base_depayload_handle_buffer:<rtpvrawdepay0> error: Input buffers need to have RTP caps set on them. This is usually achieved by setting the 'caps' property of the upstream source element (often udpsrc or appsrc), or by putting a capsfilter element before the depayloader and setting the 'caps' property on that. Also see http://cgit.freedesktop.org/gstreamer/gst-plugins-good/tree/gst/rtp/README
0:00:00.013569232 587282 0x70a4cc007c60 WARN basesrc gstbasesrc.c:3127:gst_base_src_loop:<udpsrc0> error: Internal data stream error.
0:00:00.013572843 587282 0x70a4cc007c60 WARN basesrc gstbasesrc.c:3127:gst_base_src_loop:<udpsrc0> error: streaming stopped, reason not-negotiated (-4)
[ERROR] [1715286998.696687399] [gscam_publisher]: Could not get gstreamer sample.
However, a pipeline was still created, so the node error/exit was not triggered. I'm going to probably suggest (once I get a little more comfortable with this) adding the following after this detection so it's at least printed:
if (error && error->code != 0)
{
RCLCPP_ERROR_STREAM(get_logger(), "Gstreamer errors after pipeline: [" << error->code << "] " << error->message);
}
So that even in non-verbose mode, we'll see the errors, like in my issue:
[ERROR] [1715287940.967268950] [gscam_publisher]: Gstreamer errors after pipeline: [4] could not set property "caps" in element "udpsrc0" to "'application/x-rtp, sampling=(string)YCbCr-4:2:2, width=(string)640, height=(string)480'"
So, not a direct answer to your question because I don't really understand exactly what you're asking, but my error was that I was setting my configuration wrong:
export GSCAM_CONFIG="udpsrc port=5000 caps='application/x-rtp, sampling=(string)YCbCr-4:2:2, width=(string)640, height=(string)480' ! rtpvrawdepay ! videoconvert"
The above fails because I'm not properly escaping my quotes
Fixed with
export GSCAM_CONFIG="udpsrc port=5000 caps=\"application/x-rtp, sampling=(string)YCbCr-4:2:2, width=(string)640, height=(string)480\" ! rtpvrawdepay ! videoconvert"
And then, I get a nice video stream with
ros2 run gscam gscam_node --ros-args --log-level DEBUG
I am using a rgb camera with RTSP
server. Does the pkg works with rtspsrc
?
I am trying to get gscam working on ROS2 Humble.
Pipeline
gst-launch-1.0 -v rtspsrc location=rtsp://main:main@1xx.1xx.100.xxx:554/11 do-retransmission=false latency=0 ! queue ! rtph264depay ! h264parse ! avdec_h264 ! videoconvert ! videoscale ! video/x-raw,width=640,height=480 ! autovideosink
Environment
ROS_DISTRO=humble RMW_IMPLEMENTATION=rmw_cyclonedds_cpp
Can you please help me? @gitjuanr @jeremroy @KnechtNoobrecht