https://github.com/loyd/rscam
Rust wrapper for v4l2
https://github.com/loyd/rscam
camera capture rust v4l2 video
Last synced: about 1 year ago
JSON representation
Rust wrapper for v4l2
- Host: GitHub
- URL: https://github.com/loyd/rscam
- Owner: loyd
- License: other
- Created: 2015-01-03T18:03:28.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2023-10-05T19:56:56.000Z (over 2 years ago)
- Last Synced: 2024-10-14T02:23:11.456Z (over 1 year ago)
- Topics: camera, capture, rust, v4l2, video
- Language: Rust
- Homepage:
- Size: 124 KB
- Stars: 114
- Watchers: 8
- Forks: 22
- Open Issues: 14
-
Metadata Files:
- Readme: README.md
- License: LICENSE-APACHE
Awesome Lists containing this project
README
# rscam
[](https://travis-ci.org/loyd/rscam)
[](https://crates.io/crates/rscam)
[](https://docs.rs/rscam)
## This project is no longer maintained
Consider to use [https://github.com/raymanfx/libv4l-rs](libv4l-rs) or something else.
If you would be interested in taking over some of the maintenance of the project, please let me know.
## Overview
Rust wrapper for v4l2.
```rust
let mut camera = rscam::new("/dev/video0").unwrap();
camera.start(&rscam::Config {
interval: (1, 30), // 30 fps.
resolution: (1280, 720),
format: b"MJPG",
..Default::default()
}).unwrap();
for i in 0..10 {
let frame = camera.capture().unwrap();
let mut file = fs::File::create(&format!("frame-{}.jpg", i)).unwrap();
file.write_all(&frame[..]).unwrap();
}
```
The wrapper uses v4l2 (e.g. `v4l2_ioctl()` instead of `ioctl()`) until feature `no_wrapper` is enabled. The feature can be useful when it's desirable to avoid dependence on *libv4l2* (for example, cross-compilation).
## License
Licensed under either of
* Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
* MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
at your option.
### Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.