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

[Android 13] V4L2 Sink is empty. #3795

Closed
Antonino294 opened this issue Mar 12, 2023 · 1 comment
Closed

[Android 13] V4L2 Sink is empty. #3795

Antonino294 opened this issue Mar 12, 2023 · 1 comment

Comments

@Antonino294
Copy link

  • [Y] I have read the FAQ.
  • [Y] I have searched in existing issues.

Environment

  • OS: [Debian 11]
  • scrcpy version: [2.0]
  • installation method: [manual build]
  • device model: Samsung A51
  • Android version: [13]

Describe the bug

Using the --v42l-sink argument results in an empty, unplayable stream, as showcased by ffplay's output:

scrcpy -m 800 --v4l2-sink=/dev/video3 -N

scrcpy 2.0 <https://github.com/Genymobile/scrcpy>
INFO: Video orientation is locked for v4l2 sink. See --lock-video-orientation.
INFO: No display and no recording: audio disabled
/usr/local/share/scrcpy/scrcpy-server: 1 file pushed. 1.5 MB/s (52867 bytes in 0.033s)
[server] INFO: Device: samsung SM-A515F (Android 13)
INFO: v4l2 sink started to device: /dev/video3
ffplay -i /dev/video3

ffplay version 4.3.5-0+deb11u1 Copyright (c) 2003-2022 the FFmpeg developers
  built with gcc 10 (Debian 10.2.1-6)

...

nan    :  0.000 fd=   0 aq=    0KB vq=    0KB sq=    0B f=0/0

The ffmpeg version is the one from Debian's repositories. Using v4l2 without scrcpy works as expected:

ffmpeg -i Video.mp4 -f v4l2 /dev/video3

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'Video.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2mp41
    encoder         : Lavf58.29.100
  Duration: 00:00:51.13, start: 0.000000, bitrate: 889 kb/s
    Stream #0:0(und): Video: av1 (Main) (av01 / 0x31307661), yuv420p(tv, bt709), 952x720, 753 kb/s, 60.02 fps, 60 tbr, 15360 tbn, 15360 tbc (default)
    Metadata:
      handler_name    : ISO Media file produced by Google Inc.
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 127 kb/s (default)
    Metadata:
      handler_name    : ISO Media file produced by Google Inc.
[libdav1d @ 0x5599ff9be4c0] libdav1d 0.7.1
Stream mapping:
  Stream #0:0 -> #0:0 (av1 (libdav1d) -> rawvideo (native))
Press [q] to stop, [?] for help
Output #0, video4linux2,v4l2, to '/dev/video3':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2mp41
    encoder         : Lavf58.45.100
    Stream #0:0(und): Video: rawvideo (I420 / 0x30323449), yuv420p, 952x720 [SAR 1:1 DAR 119:90], q=2-31, 493516 kb/s, 60 fps, 60 tbn, 60 tbc (default)
    Metadata:
      handler_name    : ISO Media file produced by Google Inc.
      encoder         : Lavc58.91.100 rawvideo
frame=  253 fps=0.0 q=-0.0 Lsize=N/A time=00:00:04.21 bitrate=N/A speed= 4.9x
ffplay -i /dev/video3

ffplay version 4.3.5-0+deb11u1 Copyright (c) 2003-2022 the FFmpeg developers
  built with gcc 10 (Debian 10.2.1-6)
  configuration: --prefix=/usr --extra-version=0+deb11u1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-pocketsphinx --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  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
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  7.100 /  5.  7.100
  libswresample   3.  7.100 /  3.  7.100
  libpostproc    55.  7.100 / 55.  7.100
Input #0, video4linux2,v4l2, from '/dev/video3':B sq=    0B f=0/0
  Duration: N/A, start: 3849.855156, bitrate: 246758 kb/s
    Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 952x720, 246758 kb/s, 30 fps, 30 tbr, 1000k tbn, 1000k tbc

...

It's also worth noting that using the H265 codec with any encoder results in an immediate V4L2 error (results above were done with H264):

scrcpy --video-codec=h265 -m 800 --v4l2-sink=/dev/video3 -N

scrcpy 2.0 <https://github.com/Genymobile/scrcpy>
INFO: Video orientation is locked for v4l2 sink. See --lock-video-orientation.
INFO: No display and no recording: audio disabled
/usr/local/share/scrcpy/scrcpy-server: 1 file pushed. 1.4 MB/s (52867 bytes in 0.036s)
[server] INFO: Device: samsung SM-A515F (Android 13)
INFO: v4l2 sink started to device: /dev/video3
ERROR: [FFmpeg] Unknown V4L2 pixel format equivalent for yuv420p
ERROR: Failed to write header to /dev/video3
WARN: Could not send packet to v4l2 sink
ERROR: Could not send frame to v4l2 sink
^C

It might be more appropriate to open a separate issue for this, as I haven't tested this thoroughly.

@rom1v rom1v closed this as completed in cbca79b Mar 12, 2023
@rom1v
Copy link
Collaborator

rom1v commented Mar 12, 2023

Thank you very much for your report. Fixed by cbca79b on master (just git pull)

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

No branches or pull requests

2 participants