stoth68000 / sc0710

Linux driver for the Elgato 4k60 Pro Mk.2
Other
137 stars 18 forks source link

Unstable stream from /dev/video0 #10

Open dehahost opened 2 years ago

dehahost commented 2 years ago

Hello. As a newcomer I want to report unstable streaming from /dev/video0 block device. I tried to encode from it with ffmpeg from your Makefile and it stopped after a few tens of seconds.

In my theory, something in the module resets and the block device is not available for a short period of time.


Command and its output:

 ~/tempie % ffmpeg -r 59.94 -f rawvideo -pixel_format yuyv422 -video_size 1920x1080 -i /dev/video0 -vcodec libx264 -f mpegts -y -report encoder0.ts
ffmpeg started on 2022-09-18 at 21:50:33
Report written to "ffmpeg-20220918-215033.log"
Log level: 48
ffmpeg version 4.4.2-0ubuntu0.22.04.1 Copyright (c) 2000-2021 the FFmpeg developers
  built with gcc 11 (Ubuntu 11.2.0-19ubuntu1)
  configuration: --prefix=/usr --extra-version=0ubuntu0.22.04.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --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-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-pocketsphinx --enable-librsvg --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  libavutil      56. 70.100 / 56. 70.100
  libavcodec     58.134.100 / 58.134.100
  libavformat    58. 76.100 / 58. 76.100
  libavdevice    58. 13.100 / 58. 13.100
  libavfilter     7.110.100 /  7.110.100
  libswscale      5.  9.100 /  5.  9.100
  libswresample   3.  9.100 /  3.  9.100
  libpostproc    55.  9.100 / 55.  9.100
Input #0, rawvideo, from '/dev/video0':
  Duration: N/A, start: 0.000000, bitrate: 1988665 kb/s
  Stream #0:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 1920x1080, 1988665 kb/s, 59.94 tbr, 59.94 tbn, 59.94 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[libx264 @ 0x563ada966ec0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 0x563ada966ec0] profile High 4:2:2, level 4.2, 4:2:2, 8-bit
Output #0, mpegts, to 'encoder0.ts':
  Metadata:
    encoder         : Lavf58.76.100
  Stream #0:0: Video: h264, yuv422p(tv, progressive), 1920x1080, q=2-31, 59.94 fps, 90k tbn
    Metadata:
      encoder         : Lavc58.134.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
/dev/video0: Invalid argumentze=    3072kB time=00:00:24.24 bitrate=1038.2kbits/s speed=0.952x    
frame= 1535 fps= 58 q=-1.0 Lsize=    4117kB time=00:00:25.55 bitrate=1319.7kbits/s speed=0.973x    
video:3758kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 9.571123%
[libx264 @ 0x563ada966ec0] frame I:8     Avg QP:20.88  size: 56744
[libx264 @ 0x563ada966ec0] frame P:417   Avg QP:23.71  size:  5662
[libx264 @ 0x563ada966ec0] frame B:1110  Avg QP:23.98  size:   931
[libx264 @ 0x563ada966ec0] consecutive B-frames:  3.1%  0.5%  2.5% 93.8%
[libx264 @ 0x563ada966ec0] mb I  I16..4: 73.1% 18.5%  8.4%
[libx264 @ 0x563ada966ec0] mb P  I16..4:  3.6%  2.5%  0.3%  P16..4: 11.6%  1.3%  1.1%  0.0%  0.0%    skip:79.6%
[libx264 @ 0x563ada966ec0] mb B  I16..4:  0.1%  0.0%  0.0%  B16..8:  7.8%  0.2%  0.0%  direct: 0.3%  skip:91.6%  L0:38.0% L1:60.7% BI: 1.4%
[libx264 @ 0x563ada966ec0] 8x8 transform intra:33.3% inter:80.1%
[libx264 @ 0x563ada966ec0] coded y,uvDC,uvAC intra: 8.9% 37.1% 7.0% inter: 0.7% 2.8% 0.2%
[libx264 @ 0x563ada966ec0] i16 v,h,dc,p: 29% 57%  6%  9%
[libx264 @ 0x563ada966ec0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 13% 24% 55%  2%  1%  1%  2%  1%  1%
[libx264 @ 0x563ada966ec0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 29% 23% 22%  4%  5%  4%  4%  4%  3%
[libx264 @ 0x563ada966ec0] i8c dc,h,v,p: 54% 31% 12%  3%
[libx264 @ 0x563ada966ec0] Weighted P-Frames: Y:4.1% UV:1.9%
[libx264 @ 0x563ada966ec0] ref P L0: 60.0%  6.9% 25.1%  7.6%  0.5%
[libx264 @ 0x563ada966ec0] ref B L0: 90.8%  8.0%  1.2%
[libx264 @ 0x563ada966ec0] ref B L1: 97.1%  2.9%
[libx264 @ 0x563ada966ec0] kb/s:1202.07

Filtered out error:

/dev/video0: Invalid argument

ffmpeg log: ffmpeg-20220918-215033.log dmesg: dmesg-cap.log

I am using 64-bit Ubuntu 22.04.1 LTS with Linux kernel in version 5.15.0-47-generic. PlayStation 4 Pro is the source of video.

odecif commented 2 years ago

I am experiencing the same issue with the same symptoms and error when using the examples regarding streaming and encoding from the makefile. The video streams/encodes just fine for a few seconds (somewhere between 2 and 30 seconds) then abruptly stops. My logs are pretty much identical to dehahosts with (what I think) the most relevant parts being the following from the FFmpeg-log:

[libx264 @ 0x55afd3325a80] frame=1204 QP=22.76 NAL=0 Slice:B Poc:406 I:0    P:96   SKIP:8064 size=258 bytes
/dev/video2: Invalid argument
[out_0_0 @ 0x55afd332c580] EOF on sink link out_0_0:default.
No more output streams to write to, finishing.
[libx264 @ 0x55afd3325a80] frame=1205 QP=19.31 NAL=2 Slice:P Poc:416 I:27   P:166  SKIP:7967 size=879 bytes

My system: Manjaro Linux 22.0.0 Kernel 5.15.78-1-MANJARO i9-10900K Tested sources are a camera with hdmi-output and a cheap chinese RCA->HDMI upscaler/adapter (1080p) hooked up to an old PlayStation 2.