Compiling camera_capture v0.5.0
Compiling crossbeam-queue v0.2.1
Compiling memoffset v0.5.3
Compiling num-iter v0.1.40
error: failed to run custom build command for `camera_capture v0.5.0`
Caused by:
process didn't exit successfully: `/home/eqelibari/Projects/1/testsavefile/target/debug/build/camera_capture-fa6eea4c9a055251/build-script-build` (exit code: 101)
--- stdout
cargo:rerun-if-changed=Cargo.toml
--- stderr
thread 'main' panicked at 'library `v4l2` not found: Failure { command: "\"pkg-config\" \"--static\" \"--libs\" \"--cflags\" \"libv4l2\"", output: Output { status: ExitStatus(ExitStatus(256)), stdout: "", stderr: "Package libv4l2 was not found in the pkg-config search path.\nPerhaps you should add the directory containing `libv4l2.pc\'\nto the PKG_CONFIG_PATH environment variable\nNo package \'libv4l2\' found\n" } }', src/libcore/result.rs:1188:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
warning: build failed, waiting for other jobs to finish...
error: build failed
use rscam::{Camera, Config};
use std::fs;
use std::io::Write;
fn main() {
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();
}
}
it outputs ;
Compiling testsavefile v0.1.0 (/home/eqelibari/Projects/1/testsavefile)
Finished dev [unoptimized + debuginfo] target(s) in 0.55s
Running `target/debug/testsavefile`
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: BadResolution', src/libcore/result.rs:1188:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
I tried to change the resolution in higher pixels,but it still panic with the same error..
@cuviper I just had to change the format, from MJPEG to RGB3 or Default (in my case).
Its capture 10 jpg images and saves them,but now when i try opening these images , an error message is printing me: Could not load Image: frame-1.jpg. Error interpreting JPEG image file (Not a JPEG file: starts with 0xfc 0xfc). How can i fix this..