Skip to content
This repository was archived by the owner on Feb 12, 2022. It is now read-only.

Commit 7fbcfcc

Browse files
jpeddicordmm318
authored andcommitted
Initial commit
0 parents  commit 7fbcfcc

14 files changed

+1224
-0
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
*Issue #, if available:*
2+
3+
*Description of changes:*
4+
5+
6+
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

.travis.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
install:
2+
- git clone https://github.com/ros-industrial/industrial_ci.git .ros_ci
3+
script:
4+
- .ros_ci/travis.sh

README.md

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
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

h264_video_encoder/CMakeLists.txt

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
cmake_minimum_required(VERSION 2.8)
2+
project(h264_video_encoder)
3+
4+
5+
add_compile_options(-std=c++11)
6+
7+
find_package(aws_common REQUIRED)
8+
9+
find_package(catkin REQUIRED COMPONENTS
10+
h264_encoder_core
11+
aws_ros1_common
12+
image_transport
13+
message_generation
14+
sensor_msgs
15+
kinesis_video_msgs)
16+
17+
catkin_package(CATKIN_DEPENDS
18+
aws_ros1_common
19+
image_transport
20+
message_runtime)
21+
22+
23+
#############
24+
## Compile ##
25+
#############
26+
27+
set(h264_video_encoder_SRCS
28+
src/h264_video_encoder.cpp
29+
)
30+
set(h264_video_encoder_INCS
31+
include
32+
${aws_common_INCLUDE_DIRS}
33+
${catkin_INCLUDE_DIRS}
34+
)
35+
set(h264_video_encoder_LIBS
36+
${catkin_LIBRARIES}
37+
aws_common
38+
)
39+
40+
# add the publisher example
41+
add_executable(${PROJECT_NAME} src/main.cpp ${h264_video_encoder_SRCS})
42+
add_library(${PROJECT_NAME}_lib STATIC ${h264_video_encoder_SRCS})
43+
44+
target_include_directories(${PROJECT_NAME} PRIVATE ${h264_video_encoder_INCS})
45+
target_include_directories(${PROJECT_NAME}_lib PUBLIC ${h264_video_encoder_INCS})
46+
47+
target_link_libraries(${PROJECT_NAME} ${h264_video_encoder_LIBS})
48+
target_link_libraries(${PROJECT_NAME}_lib ${h264_video_encoder_LIBS})
49+
50+
add_dependencies(${PROJECT_NAME}
51+
${catkin_EXPORTED_TARGETS}
52+
${${PROJECT_NAME}_EXPORTED_TARGETS}
53+
)
54+
55+
56+
#############
57+
## Install ##
58+
#############
59+
60+
# Mark executables and/or libraries for installation
61+
install(TARGETS ${PROJECT_NAME}
62+
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
63+
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
64+
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
65+
)
66+
install(DIRECTORY launch/ DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/launch)
67+
install(DIRECTORY config/ DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/config)
68+
69+
70+
#############
71+
## Tests ##
72+
#############
73+
74+
if(CATKIN_ENABLE_TESTING)
75+
find_package(rostest REQUIRED)
76+
add_rostest_gtest(test_h264_video_encoder
77+
test/test_h264_video_encoder.test
78+
test/h264_video_encoder_test.cpp)
79+
target_include_directories(test_h264_video_encoder PRIVATE ${h264_video_encoder_INCS})
80+
target_link_libraries(test_h264_video_encoder ${PROJECT_NAME}_lib)
81+
endif()

0 commit comments

Comments
 (0)