From f36cd5c180ece086e1e286fdaf975d8251278b52 Mon Sep 17 00:00:00 2001 From: Sam Armstrong Date: Thu, 27 Sep 2018 16:50:21 +1000 Subject: [PATCH] update readme --- README.md | 44 ++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 40 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 5731a97..3197e56 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,48 @@ # ros_rtsp +ROS package to subscribe to an ROS Image topic (and as many other video sources as you want) and serve it up as a RTSP video feed with different mount points. + This is still very much a work in progress. Developing on a mix of Ubuntu 16.04 and 18.04. -ROS package to subscribe to an ROS Image topic and serve it up as a RTSP video feed. + ## Dependencies -Ensure you have gstreamer development libs installed for your system. +- ROS + +- gstreamer development libs: ``` sudo apt-get install libgstreamer-plugins-base1.0-dev libgstreamer-plugins-good1.0-dev libgstreamer-plugins-bad1.0-dev libgstrtspserver-1.0-dev ``` -## Setup -Change the config/stream_setup.yaml to suit your required streams. There are 2 types to choose from: [cam, topic]. Cam should work with nearly any video source plugin available with gstreamer. +- gstreamer: For linux (https://gstreamer.freedesktop.org/documentation/installing/on-linux.html) +``` +apt-get install libgstreamer1.0-0 gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly gstreamer1.0-libav gstreamer1.0-doc gstreamer1.0-tools +``` +For other platforms: https://gstreamer.freedesktop.org/documentation/installing/index.html + +## Stream Setup +Change the config/stream_setup.yaml to suit your required streams. + +``` +# Set up your streams to rtsp here. +streams: # Cannot rename - must leave this as is. + + # Example v4l2 camera stream + stream-x: # Can name this whatever you choose + type: cam # cam - Will not look in ROS for a image. The video src is set in the 'source' parameter. + source: "v4l2src device=/dev/video0 ! videoconvert ! videoscale ! video/x-raw,framerate=15/1,width=1280,height=720" # Should work with most valid gstreamer piplines (ending with raw video) + mountpoint: /front # Choose the mountpoint for the rtsp stream. This will be able to be accessed from rtsp:///front + bitrate: 800 # bitrate for the h264 encoding. + + # Example ROS Image topic stream + stream-42: # Can name this whatever you choose + type: topic # topic - Image is sourced from a sensor_msgs::Image topic + source: /usb_cam0/image_raw # The ROS topic to subscribe to + mountpoint: /back # Choose the mountpoint for the rtsp stream. This will be able to be accessed from rtsp:///back + bitrate: 500 # bitrate for the h264 encoding. +``` + +## Checking the streams +The best way to check a stream is working is to use gst-launch-1.0 as follows: + +``` +gst-launch-1.0 -v rtspsrc location=rtsp://:8554/ drop-on-latency=true use-pipeline-clock=true do-retransmission=false latency=0 protocols=GST_RTSP_LOWER_TRANS_UDP ! rtph264depay ! h264parse ! avdec_h264 ! xvimagesink sync=true +``` \ No newline at end of file