You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I am trying to connect my camera and get the frames with v4l.
Something like this
let mut dev = Device::new(0).expect("Failed to open device");
let mut fmt = dev.format().expect("Failed to read format");
fmt.width = 1280;
fmt.height = 720;
fmt.fourcc = FourCC::new(b"H264");
dev.set_format(&fmt).expect("Failed to write format");
let mut stream = MmapStream::with_buffers(&mut dev, Type::VideoCapture, 4)
.expect("Failed to create buffer stream");
tokio::spawn(async move {
// Wait for connection established
notify_video.notified().await;
// Send our video file frame at a time. Pace our sending so we send it at the same speed it should be played back as.
// This isn't required since the video is timestamped, but we will such much higher loss if we send all at once.
let sleep_time = Duration::from_millis(500);
loop {
let (frame, _) = stream.next().unwrap();
tokio::time::sleep(sleep_time).await;
video_track
.write_sample(&Sample {
data: frame.to_vec().into(),
duration: Duration::from_millis(1000),
..Default::default()
})
.await?;
}
let _ = video_done_tx.try_send(());
Result::<()>::Ok(())
});
But when I execute the example code, the player in the html doesnt play anything.
Can someone help me?
I am trying to get this to work to implement it with tauri
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi, I am trying to connect my camera and get the frames with v4l.
Something like this
But when I execute the example code, the player in the html doesnt play anything.
Can someone help me?
I am trying to get this to work to implement it with tauri
Beta Was this translation helpful? Give feedback.
All reactions