1 unstable release
0.0.2 | Oct 23, 2019 |
---|
#289 in Video
38KB
1K
SLoC
rpi-video-rs
This project implements H264
video record on Raspberry Pi. It uses the
rust-ffi
binding library
rpi-mmal-rs.
Usage
Add the following to your Cargo.toml
:
[dependencies]
rpi-video-rs = "0.0.2"
You could checkout the user code in folder examples/
.
And run the simple
one as below.
cargo run --example simple
Development
Since this project requires the real camera to record H264 videos, you needs a
RPI to run or test. But you could also uses a cross-compiling environment for
compiling and developing. We offers a Dockerfile (in folder tools/docker/
)
which is a separate cross-compiling environment.
For developing on either a RPI device or a Docker container, you should install the standard Rust development environment, and then adds Rust targets as below.
rustup target add arm-unknown-linux-gnueabihf
rustup target add armv7-unknown-linux-gnueabihf
Installing Camera Device on RPI
- Adds text
bcm2835-v4l2
to the bottom of file/etc/modules
.
sudo echo bcm2835-v4l2 >> /etc/modules
- Activates the camera in configuration.
sudo raspi-config
-
Follows the prompt to reboot Raspberry PI.
-
You could use the command
raspivid
to test recording aH264
video and check if the camera is installed properly.
raspivid -o test_video.h264
C Version Code
- Enters into the folder
tools/c_ver
, and runsmake
to compile the commandrpi_video.out
.
pushd tools/c_ver
make
- Runs the build command
rpi_video.out
to record a sample video.
./rpi_video.out
Rust Simple Example
You could run the Rust simple example as below.
cargo run --example simple
TODO
- Integrates with a CI for testing successful compilation.
Dependencies
~0–3MB
~50K SLoC