Package to stream ROS video topics using WebRTC, with a custom signaling server and protocol.
WebRTC is a powerful technology that enables real-time communication of audio, video, and data between web browsers and other clients. The webrtc_ros package provides a custom signaling server and protocol specifically designed for streaming ROS video topics using WebRTC. This allows ROS users to easily set up real-time video streaming from their robots to web browsers or other WebRTC-enabled clients, without needing to worry about the complexities of WebRTC signaling. The package is lightweight and flexible, making it a great choice for ROS users who want to leverage the power of WebRTC for their video streaming needs.
This is an example of how you may give instructions on setting up your project locally. To get a local copy up and running, follow these simple example steps.
-
Clone and move it into your
ROS2workspacecd ~/git # or the folder where you want to keep your git repositories (e.g., `~/Develop`) git clone git@github.com:fly4future/webrtc_ros.git cd ~/ros2_ws/src ln -sf ~/git/webrtc_ros .
[!NOTE] Don't forget to have your SSH key added to your GitHub account. If you don't have one, you can follow this guide.
-
Install dependencies and build the workspace
cd ~/ros2_ws sudo apt update rosdep update rosdep install --from-paths src --ignore-src -r -y
-
Build the workspace
colcon build
Important
- To run the av1 encoder, you need to install the rtp plugin from https://github.com/GStreamer/gst-plugins-rs
- To run the h264 encoder with vaapi hardware acceleration, you need to have installed
sudo apt install gstreamer1.0-vaapiand have a compatible Intel or AMD GPU with the necessary drivers.
You have to run the signaling server first, and then the streamer node. You can use the provided launch file to start both:
-
Run the signaling server
python3 src/webrtc_ros/scripts/signaling_server.py
[!NOTE] You should have the
websocketsPython package installed to run the signaling server. -
Source the workspace and run the streamer node
source install/setup.bash ros2 run webrtc_ros webrtc_streamer[!IMPORTANT] Optionally, you can specify parameters for the streamer node, such as the signaling server URL, the encoding format, and the hardware acceleration method. For example:
ros2 run webrtc_ros webrtc_streamer --ros-args \ -p signaling_server_url:=ws://localhost:8173/uav124 \ # The URL of the signaling server, including the unique client ID (e.g., "uav124") -p encoder:=h264 \ # The video encoding format ("h264" or "av1") -p hw_acceleration:=vaapi # The hardware acceleration method ("cpu", "nv" for NVIDIA, "vaapi" for Intel/AMD)
