16 releases

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

#6 in Video

Download history 53/week @ 2019-11-10 133/week @ 2019-11-17 114/week @ 2019-11-24 93/week @ 2019-12-01 132/week @ 2019-12-08 104/week @ 2019-12-15 56/week @ 2019-12-22 126/week @ 2019-12-29 135/week @ 2020-01-05 169/week @ 2020-01-12 191/week @ 2020-01-19 133/week @ 2020-01-26 69/week @ 2020-02-02 99/week @ 2020-02-09 77/week @ 2020-02-16

430 downloads per month
Used in 3 crates (2 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