Skip to content
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

Fix example forward video #22

Closed

Conversation

mijoharas
Copy link
Contributor

@mijoharas mijoharas commented Dec 25, 2020

Hi!

These two examples didn't work for me using v4l2loopback. I figured out that this would work after looking at your stream_forward_mmap.rs example.

The error message I would get is:

thread 'main' panicked at 'Failed to set format of output device: Os { code: 16, kind: Other, message: "Device or resource busy" }', examples/forward_frame.rs:60:10

Incidentally, when I try the example from stream_forward_mmap it appears to work correctly, but if I try and play it with ffplay I'm not able to see anything.

I realise this example is quite new, should it be working?

(if it helps, the output I get after running stream_forward from running ffplay /dev/video2:

ffplay /dev/video2  
ffplay version n4.3.1 Copyright (c) 2003-2020 the FFmpeg developers
  built with gcc 10.2.0 (GCC)
  configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-amf --enable-avisynth --enable-cuda-llvm --enable-lto --enable-fontconfig --enable-gmp --enable-gnutls --enable-gpl --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libdav1d --enable-libdrm --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libiec61883 --enable-libjack --enable-libmfx --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librav1e --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid --enable-nvdec --enable-nvenc --enable-shared --enable-version3
  libavutil      56. 51.100 / 56. 51.100
  libavcodec     58. 91.100 / 58. 91.100
  libavformat    58. 45.100 / 58. 45.100
  libavdevice    58. 10.100 / 58. 10.100
  libavfilter     7. 85.100 /  7. 85.100
  libswscale      5.  7.100 /  5.  7.100
  libswresample   3.  7.100 /  3.  7.100
  libpostproc    55.  7.100 / 55.  7.100
    nan    :  0.000 fd=   0 aq=    0KB vq=    0KB sq=    0B f=0/0   

and then hanging)

@raymanfx
Copy link
Owner

Hi, can you check out the next branch? I think I ran into a similar issue on Fedora 33, but it was actually the buggy v4l2loopback module to blame.

The "fix" or workaround I found is here:
https://github.com/raymanfx/libv4l-rs/blob/next/examples/stream_forward_mmap.rs#L90.

@raymanfx
Copy link
Owner

Sorry, I got confused for a sec here. The master branch already has the "fix", but not for the two examples you fixed here.

I'll have a look at this soon - but I can say that the current code was tested on Fedora 33 with the latest v4l2loopback master branch and works fine, even using ffplay.

@mijoharas
Copy link
Contributor Author

Hey, yeah, I just copied the fix from that example to here.

It'd be good to understand what's not working about the stream_forward_mmap file for me. I'll update if I dig in further and figure it out, but as I have something working now, I'm not sure if I will.

Thanks for the repo and everything, and merry christmas!

@mijoharas
Copy link
Contributor Author

Ok, I got curious. 67ace34 has a working (for me) stream implementation. 8586075 doesn't work for me.

@raymanfx
Copy link
Owner

That's most curious indeed.
It would certainly help if you could find out what exactly breaks it for you. As I said, I will have a look at this myself, but that might take some more days.

Anyways, thanks for putting in the effort!

@raymanfx
Copy link
Owner

I consider these examples deprecated and will remove them. The stream_* examples should cover the same usecases.

@raymanfx raymanfx closed this Dec 27, 2020
@raymanfx
Copy link
Owner

Can you open an issue about the non-working v4l2loopback & ffplay setup? Please describe what you've tried so far, which versions you used etc etc. Thanks!

@raymanfx
Copy link
Owner

I just ran some tests on Fedora 33 and was able to reproduce your issue.
Could you please check out this fix: 73fe217?

My v4l2loopback + ffplay setup works again for webcam forwarding using that patch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants