15 releases

0.5.4 Mar 21, 2018
0.5.3 Apr 26, 2016
0.5.2 Nov 4, 2015
0.4.1 Jun 24, 2015
0.3.9 Mar 27, 2015

#7 in Video

Download history 102/week @ 2018-12-20 122/week @ 2018-12-27 38/week @ 2019-01-03 52/week @ 2019-01-10 78/week @ 2019-01-17 27/week @ 2019-01-24 127/week @ 2019-01-31 90/week @ 2019-02-07 137/week @ 2019-02-14 131/week @ 2019-02-21 159/week @ 2019-02-28 121/week @ 2019-03-07 134/week @ 2019-03-14 182/week @ 2019-03-21 185/week @ 2019-03-28

160 downloads per month
Used in 3 crates (2 directly)

MIT license

85KB
2K SLoC

rscam

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).


lib.rs:

Fast wrapper for v4l2.

# use std::fs;
# use std::io::Write;
use rscam::{Camera, Config};

let mut camera = Camera::new("/dev/video0").unwrap();

camera.start(&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.

Dependencies

~192KB