gscam icon indicating copy to clipboard operation
gscam copied to clipboard

Noetic support, segfault

Open chfritz opened this issue 3 years ago • 6 comments

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.

chfritz avatar Jun 29 '21 22:06 chfritz

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

WaldoPepper avatar Sep 20 '21 07:09 WaldoPepper

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

clydemcqueen avatar Nov 04 '21 23:11 clydemcqueen

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 avatar Sep 10 '23 21:09 chfritz

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 avatar Sep 11 '23 14:09 chfritz

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 avatar Sep 11 '23 19:09 chfritz

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

chfritz avatar Sep 11 '23 20:09 chfritz