ros-drivers / gscam

ROS Camera driver for GStreamer-based video streams.
136 stars 172 forks source link

Noetic support, segfault #71

Open chfritz opened 3 years ago

chfritz commented 3 years ago

Is there any support planned for noetic? Compiling from source under ubuntu 20.04 is easy enough and works out of the box. But when running it the node segfaults right away after sending a first image.

WaldoPepper commented 2 years ago

Any news on this? Noetic support would be highly appreciated, because we ROS1'ler will stick with it for some time... ;-)

clydemcqueen commented 2 years ago

GStreamer 1.16 (default on Ubuntu 20.04) will cause a segfault. Fix: https://github.com/ros-drivers/gscam/pull/61

chfritz commented 9 months ago

You can use the appsink element, which will give you events in your C++ code with raw byte data. You'll probably want to decode from h264 first (assuming that's what your IP camera provides -- most do). You can use avdec_h264 for that, or, if you have hardware acceleration, e.g., on a Jetson, use the vendor specific gstreamer plugins for that. Once decoded, you will get full frames as byte arrays in C++. Let me know if you need any more help.

chfritz commented 9 months ago

If the images you receive from gstreamer are already in the right format (e.g., video/x-raw,format=RGB which corresponds to the ROS format rgb8), then you can publish them directly as the data field in sensor_msgs/Image messages in ROS.

chfritz commented 9 months ago

Can you post your pipeline here? As I said earlier you need to convert h264 to raw using avdec_h264, but I thought you said you are already doing that?

chfritz commented 9 months ago

That looks right to me. You'll also want to add a caps-filter after the videoconvert to tell that node what format to convert to, e.g.: gst-launch-1.0 -v rtspsrc location=(IP address) ! rtph264depay ! capsfilter caps="video/x-h264" ! h264parse ! advec_h264 ! videoconvert ! video/x-raw,format=RGB ! appsink

The bytearrays you'll get in this appsink will then just be plain-old RGB frames that you can publish.

Could you please also provide a relevant resource showing how the video stream could be published and subscribed using sensor_msgs/Image in ROS Noetic? I am a little confused since I am new to ROS and GStreamer.

That has nothing to do with gstreamer anymore, just publishing messages on ROS topics, so the very basic ROS tutorial should be all you need: http://wiki.ros.org/ROS/Tutorials/WritingPublisherSubscriber%28c%2B%2B%29#roscpp_tutorials.2FTutorials.2FWritingPublisherSubscriber.Writing_the_Publisher_Node