-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to stream to v4l2 loopback device using stream_forward_mmap example #28
Comments
Could you debug the input format (width, height, pixelformat, stride) and the output format? I can take a look at this tonight - it's been a while since I used v4l2loopback. |
Sorry, I was on mobile and did not see the attachment. So it looks like the source format (that of /dev/video4) was not applied to the v4l2loopback device (/dev/video0). We normally enforce this in the example: https://github.com/raymanfx/libv4l-rs/blob/master/examples/stream_forward_mmap.rs#L95. But from your enclosed log I see that Could you please print the |
I'm having the same issue here.
|
Okay, I need some kernel logs to get more insight here. |
I'm not sure how to turn on kernel logging for the file in question (I have tried googling, and found some answers, but can't make it work on my end). I'll try some more, and respond with dmesg output as soon as I have something. What I can see in both mine and pi-type's output is that the size and the transfer function differ, though width, height, fourcc, field, stride, colorspace, and quantization match. In the example, the only comparisons are for width, height, and fourcc. So I guess the comparison should be extended to more parameters? (In this case it is the size mismatch that leads to the copy_from_slice failure, I think.) Then again, I'd love to solve the underlying problem behind the difference in size as well. |
Yes, the mismatch of the Perhaps whatever debugging is there by default could suffice. Would you mind dumping the (last few) lines of dmesg for me? I'll see whether they contain anything useful. |
I just tested this myself on Fedora 34 and it appears to be working fine on My log:
EDIT: Okay, so if I enforce the MJPG pixelformat on the source device (thus it will be enforced on the output device by the example), I'm seeing the same issue. I'll have to dig more into the v4l2loopback code. |
I'm on Pop OS (a fork of Ubuntu 20.10), and I've tried compiling v4l2loopback myself as well as using the one provided. Currently the tail end of my dmesg has the lines:
I've been running the example code once after each reload of the v4l2loopback module, so there's no output at all. I've added Thanks for helping out! |
Should be fixed now. I would appreciate if you could give that commit (in the |
I can confirm that it works on my end. Thanks! |
FYI we found some more issues related to compressed frame forwarding, which hopefully should be fixed in the Thanks to @reyapo for spotting and fixing those other issues. |
Cool! I found the eye-rs project the other day, that's how I came up with the enumeration code in the other bug report. As I'm muddling along learning Rust, I hope I'll be able to contribute fixes as well as reports in the future. Cheers! |
I cloned master, and ran
cargo build --examples
, then ran./target/debug/examples/stream_forward_mmap -d 4 -o 0
(and yes, my loopback is/dev/video/0
and my USB webcam is/dev/video/4
- i double checked).The result is a panic with a message about slice lengths not matching:
thread 'main' panicked at 'source slice length (460800) does not match destination slice length (1228800)', /home/filip/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/slice/mod.rs:2775:13
Complete output in enclosed text file.
Any idea what's wrong? I'm a bit of a beginner at both Rust and V4l2
output.txt
The text was updated successfully, but these errors were encountered: