From 415b3821f943d00c682cf2530c361099d9e28728 Mon Sep 17 00:00:00 2001 From: Lars Ludvigsen Date: Sat, 22 Mar 2025 14:17:04 +0100 Subject: [PATCH 1/5] Updated README --- README.md | 174 +++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 165 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index cbe4568..9446659 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,173 @@ -web_video_server [![Build Status](https://api.travis-ci.org/RobotWebTools/web_video_server.png)](https://travis-ci.org/RobotWebTools/web_video_server) -================ +# web_video_server - HTTP Streaming of ROS Image Topics in Multiple Formats -#### HTTP Streaming of ROS Image Topics in Multiple Formats -This node combines the capabilities of [ros_web_video](https://github.com/RobotWebTools/ros_web_video) and [mjpeg_server](https://github.com/RobotWebTools/mjpeg_server) into a single node. +This node provides HTTP streaming of ROS image topics in various formats, making it easy to view robot camera feeds and other image topics in a web browser without requiring special plugins or extensions. -For full documentation, see [the ROS wiki](http://ros.org/wiki/web_video_server). +## Features -[Doxygen](http://docs.ros.org/indigo/api/web_video_server/html/) files can be found on the ROS wiki. +- Stream ROS image topics over HTTP in multiple formats: + - MJPEG (Motion JPEG) + - VP8 (WebM) + - VP9 (WebM) + - H264 (MP4) + - PNG streams + - ROS compressed image topics +- Adjustable quality, size, and other streaming parameters +- Web interface to browse available image topics +- Single image snapshot capability +- Support for different QoS profiles in ROS 2 -This project is released as part of the [Robot Web Tools](http://robotwebtools.org/) effort. +## Installation -### License +### Dependencies + +- ROS (Noetic) or ROS 2 (Humble+) +- OpenCV +- FFmpeg/libav +- Boost +- async_web_server_cpp + +### Installing packages + +For newer ROS2 distrobutions (humble, jazzy, rolling) it is possible to install web_video_server as a package: + +``` +sudo apt install ros--web-video-server +``` + +### Building from Source + +```bash +# For ROS 1 +mkdir -p ~/catkin_ws/src +cd ~/catkin_ws/src +git clone https://github.com/RobotWebTools/web_video_server.git +cd .. +catkin_make + +# For ROS 2 +mkdir -p ~/ros2_ws/src +cd ~/ros2_ws/src +git clone https://github.com/RobotWebTools/web_video_server.git +cd .. +colcon build --packages-select web_video_server +``` + +## Usage + +### Starting the Server + +```bash +# ROS 1 +rosrun web_video_server web_video_server + +# ROS 2 +ros2 run web_video_server web_video_server +``` + + +### Configuration + +#### Server Configuration Parameters + +| Parameter | Type | Default | Possible Values | Description | +|-----------|------|---------|----------------|-------------| +| `port` | int | 8080 | Any valid port number | HTTP server port | +| `address` | string | "0.0.0.0" | Any valid IP address | HTTP server address (0.0.0.0 allows external connections) | +| `server_threads` | int | 1 | 1+ | Number of server threads for handling HTTP requests | +| `ros_threads` | int | 2 | 1+ | Number of threads for ROS message handling | +| `verbose` | bool | false | true, false | Enable verbose logging | +| `default_stream_type` | string | "mjpeg" | "mjpeg", "vp8", "vp9", "h264", "png", "ros_compressed" | Default format for video streams | +| `publish_rate` | double | -1.0 | -1.0 or positive value | Rate for republishing images (-1.0 means no republishing) | + +#### Running with Custom Parameters + +You can configure the server by passing parameters via the command line: + +```bash +# ROS 1 +rosrun web_video_server web_video_server _port:=8081 _address:=localhost _server_threads:=4 + +# ROS 2 +ros2 run web_video_server web_video_server --ros-args -p port:=8081 -p address:=localhost -p server_threads:=4 +``` + +### View Available Streams +``` +http://localhost:8080/ +``` +The interface allows quick navigation between different topics and formats without having to manually construct URLs. + +This page displays: +- All available ROS image topics currently being published +- Direct links to view each topic in different formats: + - Web page with streaming image + - Direct stream + - Single image snapshot + +### Stream an Image Topic + +There are two ways to stream the Image, as a HTML page via +``` +http://localhost:8080/stream_viewer?topic=/camera/image_raw +``` +or as a HTTP multipart stream on + +``` +http://localhost:8080/stream?topic=/camera/image_raw +``` +#### URL Parameters for Streaming + +The following parameters can be added to the stream URL: + +| Parameter | Type | Default | Possible Values | Description | +|-----------|------|---------|----------------|-------------| +| `topic` | string | (required) | Any valid ROS image topic | The ROS image topic to stream | +| `type` | string | "mjpeg" | "mjpeg", "vp8", "vp9", "h264", "png", "ros_compressed" | Stream format | +| `width` | int | 0 | 0+ | Width of output stream (0 = original width) | +| `height` | int | 0 | 0+ | Height of output stream (0 = original height) | +| `quality` | int | 95 | 1-100 | Quality for MJPEG and PNG streams | +| `bitrate` | int | 100000 | Positive integer | Bitrate for H264/VP8/VP9 streams in bits/second | +| `invert` | flag | not present | present/not present | Invert image when parameter is present | +| `default_transport` | string | "raw" | "raw", "compressed", "theora" | Image transport to use | +| `qos_profile` | string | "default" | "default", "system_default", "sensor_data", "services_default" | QoS profile for ROS 2 subscribers | + +Examples: + +``` +# Stream an MJPEG at 640x480 with 90% quality +http://localhost:8080/stream?topic=/camera/image_raw&type=mjpeg&width=640&height=480&quality=90 + +# Stream H264 with higher bitrate +http://localhost:8080/stream?topic=/camera/image_raw&type=h264&bitrate=500000 + +# Stream with inverted image (rotated 180°) +http://localhost:8080/stream?topic=/camera/image_raw&invert + +``` + +### Get a Snapshot +It is also possible to get a single image snapshot +``` +http://localhost:8080/snapshot?topic=/camera/image_raw +``` +#### URL Parameters for Snapshot + +| Parameter | Type | Default | Possible Values | Description | +|-----------|------|---------|----------------|-------------| +| `topic` | string | (required) | Any valid ROS image topic | The ROS image topic to stream | +| `width` | int | 0 | 0+ | Width of output picture (0 = original width) | +| `height` | int | 0 | 0+ | Height of output picture (0 = original height) | +| `quality` | int | 95 | 1-100 | Quality for JPEG snapshots | +| `invert` | flag | not present | present/not present | Invert image when parameter is present | +| `default_transport` | string | "raw" | "raw", "compressed", "theora" | Image transport to use | +| `qos_profile` | string | "default" | "default", "system_default", "sensor_data", "services_default" | QoS profile for ROS 2 subscribers | + +## About + +This project is released as part of the [Robot Web Tools](https://robotwebtools.github.io/) effort. + +## License web_video_server is released with a BSD license. For full terms and conditions, see the [LICENSE](LICENSE) file. -### Authors +## Authors See the [AUTHORS](AUTHORS.md) file for a full list of contributors. From ac6abe62cbcb412924138d9c9f83ed78397f7996 Mon Sep 17 00:00:00 2001 From: Lars Ludvigsen Date: Sat, 22 Mar 2025 14:30:46 +0100 Subject: [PATCH 2/5] Fix typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9446659..1f1591e 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ This node provides HTTP streaming of ROS image topics in various formats, making ### Installing packages -For newer ROS2 distrobutions (humble, jazzy, rolling) it is possible to install web_video_server as a package: +For newer ROS2 distributions (humble, jazzy, rolling) it is possible to install web_video_server as a package: ``` sudo apt install ros--web-video-server From 12e907e6f49fb0727c5ed33296acefdd78b78e40 Mon Sep 17 00:00:00 2001 From: Lars Ludvigsen Date: Sat, 22 Mar 2025 14:31:42 +0100 Subject: [PATCH 3/5] Add correct branch for ROS1 --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 1f1591e..0577151 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,7 @@ sudo apt install ros--web-video-server mkdir -p ~/catkin_ws/src cd ~/catkin_ws/src git clone https://github.com/RobotWebTools/web_video_server.git +git checkout ros1 cd .. catkin_make From 16a538adf869c82873e6f165ee04f6108a6e7c40 Mon Sep 17 00:00:00 2001 From: Lars Lorentz Ludvigsen <59617571+larsll@users.noreply.github.com> Date: Wed, 23 Apr 2025 18:39:24 +0200 Subject: [PATCH 4/5] Add bash-syntax to installation command MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Błażej Sowa --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0577151..2a2aa2b 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ This node provides HTTP streaming of ROS image topics in various formats, making For newer ROS2 distributions (humble, jazzy, rolling) it is possible to install web_video_server as a package: ``` -sudo apt install ros--web-video-server +sudo apt install ros-${ROS_DISTRO}-web-video-server ``` ### Building from Source From 60f6e41a9269e671719239cde25163afa620ea7f Mon Sep 17 00:00:00 2001 From: Lars Lorentz Ludvigsen <59617571+larsll@users.noreply.github.com> Date: Wed, 23 Apr 2025 18:40:04 +0200 Subject: [PATCH 5/5] Updated build instruction MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Błażej Sowa --- README.md | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 2a2aa2b..2738767 100644 --- a/README.md +++ b/README.md @@ -36,21 +36,31 @@ sudo apt install ros-${ROS_DISTRO}-web-video-server ### Building from Source +Create a ROS workspace if you don't have one: ```bash -# For ROS 1 -mkdir -p ~/catkin_ws/src -cd ~/catkin_ws/src -git clone https://github.com/RobotWebTools/web_video_server.git -git checkout ros1 -cd .. -catkin_make +mkdir -p ~/ros_ws/src +cd ~/ros_ws/src +``` -# For ROS 2 -mkdir -p ~/ros2_ws/src -cd ~/ros2_ws/src +Clone this repository: +```bash +# ROS 2 git clone https://github.com/RobotWebTools/web_video_server.git -cd .. +# ROS 1 +git clone https://github.com/RobotWebTools/web_video_server.git -b ros1 +``` + +Install dependencies with rosdep: +```bash +cd ~/ros_ws +rosdep update +rosdep install --from-paths src -i +``` + +Build the package and source your workspace: +```bash colcon build --packages-select web_video_server +source install/setup.bash ``` ## Usage