raymanfx / libv4l-rs

Video4Linux2 bindings for Rust
MIT License
152 stars 65 forks source link

Unable to stream to v4l2loopback device using `stream_forward_mmap.rs` example on versions after 67ace34 #23

Closed mijoharas closed 3 years ago

mijoharas commented 3 years ago

Using the examples/stream_forward_mmap.rs example I am unable to stream to a v4l2loopback device and then play it with ffplay.

The last working version is the one from commit 67ace34. commit 8586075 and after does not work for me.

$ cargo build --examples && ./target/debug/examples/stream_forward_mmap -d 0 -o 2 -c 100
# output appearing to work

In another terminal:

$ 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   

Using the (now deprecated) example forward_video and this patch https://github.com/raymanfx/libv4l-rs/pull/22 worked fine.

raymanfx commented 3 years ago

Did you get a chance to try out https://github.com/raymanfx/libv4l-rs/commit/73fe21769c3c5c5b0950f0f6614cdda2aa255cc0?

mijoharas commented 3 years ago

Hey, sorry, just saw this. Yes, that works perfectly! Thanks for your help!

raymanfx commented 3 years ago

Good to hear! I'll push a new release to crates.io soon.