|
| 1 | +# h264_video_encoder |
| 2 | + |
| 3 | + |
| 4 | +## Overview |
| 5 | +This package provides a ROS Node that will encode a stream of images into an H264 video stream. |
| 6 | + |
| 7 | +**Keywords**: ROS, AWS, Kinesis |
| 8 | + |
| 9 | +### License |
| 10 | +The source code is released under [LGPL 2.1]. However, this package uses `h264_encoder_core` which incorporates several different encoding components which may further restrict the license. By default, x264 is used for software encoding, thereby applying GPL to all of h264_video_encoder. |
| 11 | + |
| 12 | +**Author**: AWS RoboMaker<br/> |
| 13 | +**Affiliation**: [Amazon Web Services (AWS)]<br/> |
| 14 | +**Maintainer **: AWS RoboMaker, [email protected] |
| 15 | + |
| 16 | +### Supported ROS Distributions |
| 17 | +- Kinetic |
| 18 | +- Lunar |
| 19 | +- Melodic |
| 20 | + |
| 21 | + |
| 22 | +## Installation |
| 23 | + |
| 24 | +### Building from Source |
| 25 | +Create a ROS workspace and a source directory |
| 26 | + |
| 27 | + mkdir -p ~/ros-workspace/src |
| 28 | + |
| 29 | +To build from source, clone the latest version from master branch and compile the package. |
| 30 | + |
| 31 | +- Clone the package into the source directory |
| 32 | + |
| 33 | + cd ~/ros-workspace/src |
| 34 | + git clone https://github.com/aws/aws-ros-utils-common.git |
| 35 | + git clone https://github.com/aws/aws-ros-utils-ros1.git |
| 36 | + git clone https://github.com/aws/aws-ros-kinesisvideo-encoder-common.git |
| 37 | + git clone https://github.com/aws/aws-ros-kinesisvideo-encoder-ros1.git |
| 38 | + |
| 39 | +- Install dependencies |
| 40 | + |
| 41 | + |
| 42 | + cd ~/ros-workspace && sudo apt-get update |
| 43 | + rosdep install --from-paths src --ignore-src -r -y |
| 44 | + |
| 45 | +- Build the packages |
| 46 | + |
| 47 | + cd ~/ros-workspace && colcon build |
| 48 | + |
| 49 | +- Configure ROS library Path |
| 50 | + |
| 51 | + source ~/ros-workspace/install/setup.bash |
| 52 | + |
| 53 | +- Build and run the unit tests |
| 54 | + |
| 55 | + colcon build --packages-select h264_video_encoder --cmake-target tests |
| 56 | + colcon test --packages-select h264_video_encoder h264_encoder core && colcon test-results --all |
| 57 | + |
| 58 | + |
| 59 | +## Launch Files |
| 60 | +A launch file called `h264_video_encoder.launch` is included in this package. The launch file uses the following arguments: |
| 61 | + |
| 62 | +| Arg Name | Description | |
| 63 | +| --------- | ------------ | |
| 64 | +| node_name | (optional) The name the H264 encoder node should be launched with. If not provided, the node name will default to `h264_video_encoder` | |
| 65 | +| config_file | (optional) A path to a rosparam config file. | |
| 66 | + |
| 67 | +An example launch file called `sample_application.launch` is included in this project that gives an example of how you can include this node in your project and provide it with arguments. |
| 68 | + |
| 69 | + |
| 70 | +## Usage |
| 71 | + |
| 72 | +### Running the node |
| 73 | +To launch the H264 encoder node, you can run the following command: |
| 74 | + |
| 75 | + roslaunch h264_video_encoder sample_application.launch |
| 76 | + |
| 77 | + |
| 78 | +## Configuration File and Parameters |
| 79 | +An example configuration file called `sample_configuration.yaml` is provided for running the H264 encoder node on a Raspberry Pi based system. |
| 80 | +When the parameters are absent in the ROS parameter server, default values are used, thus all parameters are optional. See table below for details. |
| 81 | + |
| 82 | +| Parameter Name | Description | Type | |
| 83 | +| ------------- | -----------------------------------------------------------| ------------- | |
| 84 | +| queue_size | (optional) The maximum number of incoming and outgoing messages to be queued towards the subscribed and publishing topics. | integer | |
| 85 | +| output_width | (optional) The desired width (in pixels) of each frame in the encoded video output. | integer | |
| 86 | +| output_height | (optional) The desired height (in pixels) of each frame in the encoded video output. | integer | |
| 87 | +| fps_numerator | (optional) The desired frames per second (the numerator portion when expressing FPS as a rational number) for the encoded video output. | integer | |
| 88 | +| fps_denominator | (optional) The desired frames per second (the denominator portion when expressing FPS as a rational number) for the encoded video output. | integer | |
| 89 | +| bitrate | (optional) The desired bitrate (in bits per second) of the encoded video output. | integer | |
| 90 | + |
| 91 | + |
| 92 | +## Node Details |
| 93 | + |
| 94 | +#### Published Topics |
| 95 | +| Topic Name | Message Type | Description | |
| 96 | +| ---------- | ------------ | ----------- | |
| 97 | +| *Configurable* (default="video/encoded") | kinesis_video_msgs/KinesisVideoFrame | The node will publish to a topic of a given name. Each message being published contains a chunk of the video stream, usually per video frame. | |
| 98 | + |
| 99 | +#### Subscribed Topics |
| 100 | +| Topic Name | Message Type | Description | |
| 101 | +| ---------- | ------------ | ----------- | |
| 102 | +| *Configurable* (default="/raspicam_node/image") | sensor_msgs/Image | The node will subscribe to a topic of a given name. The data is expected to be a stream of images from a source (such as a Raspberry Pi camera). | |
| 103 | + |
| 104 | + |
| 105 | +## Bugs & Feature Requests |
| 106 | +Please contact the team directly if you would like to request a feature. |
| 107 | + |
| 108 | +Please report bugs in [Issue Tracker]. |
| 109 | + |
| 110 | + |
| 111 | +[Amazon Web Services (AWS)]: https://aws.amazon.com/ |
| 112 | +[LGPL 2.1]: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html |
| 113 | +[Issue Tracker]: TODO |
| 114 | +[ROS]: http://www.ros.org |
0 commit comments