16 releases

Uses old Rust 2015

0.5.5 May 7, 2019
0.5.4 Mar 21, 2018
0.5.3 Apr 26, 2016
0.5.2 Nov 4, 2015
0.3.9 Mar 27, 2015

#406 in Images

Download history 257/week @ 2024-07-27 146/week @ 2024-08-03 199/week @ 2024-08-10 134/week @ 2024-08-17 153/week @ 2024-08-24 267/week @ 2024-08-31 180/week @ 2024-09-07 119/week @ 2024-09-14 197/week @ 2024-09-21 285/week @ 2024-09-28 131/week @ 2024-10-05 148/week @ 2024-10-12 175/week @ 2024-10-19 167/week @ 2024-10-26 250/week @ 2024-11-02 61/week @ 2024-11-09

673 downloads per month
Used in 8 crates (4 directly)

MIT/Apache

87KB
2K SLoC

rscam

Build status Crate info Documentation

Rust wrapper for v4l2.

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

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.

Dependencies