Show EOL distros: 

Package Summary

A ROS Node to Stream Image Topics Via a MJPEG Server

Package Summary

A ROS Node to Stream Image Topics Via a MJPEG Server

Package Summary

A ROS Node to Stream Image Topics Via a MJPEG Server

This package is EOL, and has been replaced by web_video_server.

About

A natural means of interacting with and checking upon the progress of the robot is through video. MJPEGs, or motion JPEGs, are a file format in which each frame of a video stream is separately compressed as a JPEG image. The mjpeg_server is a streaming server that subscribes to requested image topics in ROS and publishes those topics as MJPEG streams via HTTP. While rosbridge is capable of streaming video, as it is just another message type from ROS, the web browser is optimized to efficiently download images in binary format. Thus for increased performance benefits this additional communication channel is used. In order to deal with a user’s specific requirements the video streams can be provided at a desired quality and size to accommodate different connection speeds and interface designs. mjpeg_server is developed as part of the Robot Web Tools effort.

MJPEG Stream

Installation

To install the mjpeg_server package, you can choose to either install from source, or from the Ubuntu package:

Source

To install from source, execute the following:

  •    1 cd /path/to/your/catkin/workspace/src
       2 git clone https://github.com/RobotWebTools/mjpeg_server.git -b groovy-devel
       3 cd ../
       4 catkin_make install
    

Ubuntu Package

To install the Ubuntu package, execute the following:

  • sudo apt-get install ros-groovy-mjpeg-server

Running the Node

In a new terminal, run the mjpeg_server:

  • rosrun mjpeg_server mjpeg_server

By default the server serves streams on port 8080. If this port is already used by another process you will see an appropriate error message.

Optionally, you can set a different port on the command line when launching mjpeg_server:

  • rosrun mjpeg_server mjpeg_server _port:=8181

Accessing the Stream in a Web Browser

The stream can be viewed by any current browser. If the server runs on the local machine you can access the stream using the following URL:

  • http://localhost:8080/stream?topic=/IMAGE_TOPIC

Here, /IMAGE_TOPIC is a ROS topic generated by the image_transport module, e.g. /wide_stereo/left/image_color in case you are using a PR2.

Single image snapshots

Instead of displaying a stream of images, it is also possible to display a single image snapshot. The URL for snapshots is:

  • http://localhost:8080/snapshot?topic=/IMAGE_TOPIC

Display parameters

The image stream can be configured by several parameters. The parameters are added to the URL according to the URI scheme:

  • http://localhost:8080/stream?topic=/IMAGE_TOPIC?param1=value1?param2=value2?param3=value3

Currently the following parameters are available:

  • width (integer, default: original width)
    • The image stream will be resized to a new width and height. This parameter has to be used in conjunction with the height parameter.
    height (integer, default: original height)
    • The image stream will be resized to a new width and height. This parameter has to be used in conjunction with the height parameter.
    quality (integer, default: 90)
    • The jpeg image quality (1...100). This parameter can be used to reduce the size of the resulting mjpeg stream.
    invert (none, default: )
    • Rotates the image by 180 degrees before streaming.

The following example shows a resized version of an image stream:

  • reduced size stream displayed in a browser

Support

Please send bug reports to the GitHub Issue Tracker. Feel free to contact us at any point with questions and comments.

Wiki: mjpeg_server (last edited 2017-01-30 10:21:10 by GvdHoorn)