getting 1080p JPEG frames from my webcam @ 30 FPS

main
_ 2023-09-09 13:53:45 -05:00
parent 3da0836c8a
commit 22d20afcda
1 changed files with 10 additions and 2 deletions

View File

@ -35,12 +35,20 @@ fn main() -> Result <(), Error>
let mut buf = vec! [0u8; cap.size_image ()];
let mut bytesused = 0;
for _ in 0..5
for _ in 0..30
{
cap.wait_for_frame (&mut buf);
}
let start = Instant::now ();
for _ in 0..30
{
let rc = cap.wait_for_frame (&mut buf);
bytesused = rc.unwrap ();
dbg! (bytesused);
}
let stop = Instant::now ();
dbg! (30_000.0f32 / (stop - start).as_millis () as f32);
let mut f = std::fs::File::create ("data.jpeg").unwrap ();
f.write_all (&buf [0..bytesused]).unwrap ();