CV Video integrates OpenCV's video recording and replaying API's to ROS.
CV Video is built using catkin. Type the commands below on a terminal window to create a catkin workspace, clone the repository and build the sources:
$ mkdir -p ~/catkin_ws/src
$ cd ~/catkin_ws/src
$ catkin_init_workspace
$ git clone https://github.com/xperroni/cv_video.git
$ cd ..
$ catkin_make
CV Video can be used as a collection of standalone ROS nodes, a library, or an action server with a C++ client API.
CV Video includes two standalone ROS nodes, record
and replay
, which can be used respectively to record and replay video files. Moreover, the camcorder
action server provides video recording services for external nodes.
The camcorder
node records images from a ROS image topic and writes them to a video file. It can be accessed by external ROS nodes through an Action API.
image
(sensor_msgs/Image
)
Subscribed topic from which frames are recorded.
~path
(string, default: "<current working directory>/video.mpg"
)
Default output video file path.
~format
(string, default: MPEG
)
Default output video file encoding format.
~framerate
(double, default: 30.0
)
Default frame rate, in Frames Per Second (FPS).
~width
(integer, default: 640
)
Default frame width, in pixels.
~height
(integer, default: 640
)
Default frame height, in pixels.
The record
node records images from a ROS image topic and writes them to a video file.
image
(sensor_msgs/Image
)
Subscribed topic from which frames are recorded.
~path
(string, default: "<current working directory>/video.mpg"
)
Path to the output video file.
~format
(string, default: MPEG
)
Output video file's encoding format.
~framerate
(double, default: 30.0
)
The recorded video file's frame rate, in Frames Per Second (FPS).
~width
(integer, default: 640
)
The width of recorded frames, in pixels.
~height
(integer, default: 640
)
The height of recorded frames, in pixels.
The replay
node reads a video file and publishes its frames to a ROS image topic. See the image_transport API for details on how to read from the topic.
image
(sensor_msgs/Image
)
Topic to which replayed frames are published.
playing
(std_msgs/Bool
)
Enables other nodes to pause and resume a replay session. An `std_msgs/Bool` message published to this topic with a `false` value will pause the node, while a `true` value will make it resume.
~path
(string, default: "<current working directory>/video.mpg"
)
Path to the replayed video file.
~playing
(boolean, default: true
)
Whether the node should start replaying the video immediately. If `false`, replay only starts after a `std_msgs/Bool` with value `true` is sent to the node's `playing` topic.
~framerate
(double, default: 30.0
)
The rate at which video frames are published, in frames per second.
The cv_video::Video
class connects to a ROS image topic and provides several methods to record, replay, and/or manipulate video streams and respective frames. See the header file include/video.h
for usage instructions.
The cv_video::Camera
class provides a C++ client API to the camcorder
action server. See the header file include/camera.h
for usage instructions.