4 votes

ffmpeg se fige en utilisant une webcam à 1080p ou 60fps - Logitech Streamcam OBS Studio

J'ai besoin d'utiliser ma webcam Logitech Streamcam à 1080p (1920x1080) à 60fps mais cela ne fonctionne ni dans OBS Studio, ni dans guvcview et si je veux enregistrer la sortie comme un fichier vidéo, ffmpeg se bloque :( Merci d'avance pour votre aide.

** Mise à jour (2) 3 février : nouvelles infos/données dmesg


Studio OBS

Les étapes suivantes fonctionnent sans problème mais si je passe en 1080p et/ou 60fps, ffmpeg se fige.

# sudo modprobe v4l2loopback
# ffmpeg -f v4l2 -input_format mjpeg -framerate 30 -s 1280x720 -i /dev/video0 -pix_fmt yuyv422 -f v4l2 /dev/video2

Ffmpeg => Fichier vidéo 720p@30

Les étapes suivantes fonctionnent sans problème mais si je passe en 1080p et/ou 60fps, ffmpeg se fige.

# ffmpeg -f v4l2 -input_format mjpeg -framerate 30 -s 1280x720 -i /dev/video0 -pix_fmt yuvj422p video-test-output.mp4

Ffmpeg => Fichier vidéo 1080p@30

Avec les étapes suivantes ffmpeg se fige

# ffmpeg -f v4l2 -input_format mjpeg -framerate 30 -s 1920x1080 -i /dev/video0 -pix_fmt yuvj422p video-test-output.mp4
ffmpeg version 4.1.4-1build2 Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.2.1-4ubuntu1)
  configuration: --prefix=/usr --extra-version=1build2 --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-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --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-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --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-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  libavutil      56. 22.100 / 56. 22.100
  libavcodec     58. 35.100 / 58. 35.100
  libavformat    58. 20.100 / 58. 20.100
  libavdevice    58.  5.100 / 58.  5.100
  libavfilter     7. 40.101 /  7. 40.101
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  3.100 /  5.  3.100
  libswresample   3.  3.100 /  3.  3.100
  libpostproc    55.  3.100 / 55.  3.100
[video4linux2,v4l2 @ 0x55cf92dc5ac0] Could not find codec parameters for stream 0 (Video: mjpeg, none(bt470bg/unknown/unknown), 1920x1080): unspecified pixel format
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Input #0, video4linux2,v4l2, from '/dev/video0':
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: mjpeg, none(bt470bg/unknown/unknown), 1920x1080, 30 fps, 30 tbr, 1000k tbn, 1000k tbc
Stream mapping:
  Stream #0:0 -> #0:0 (mjpeg (native) -> h264 (libx264))
Press [q] to stop, [?] for help
Cannot determine format of input stream 0:0 after EOF
Error marking filters as finished
Exiting normally, received signal 2.

Test (1) J'ai essayé de changer les paramètres de la webcam en 1080p mais ça n'a pas marché.

# v4l2-ctl --device /dev/video0 --set-fmt-video=width=1920,height=1080,pixelformat=MJPG

Informations/données supplémentaires qui pourraient être utiles

# uname -r
5.3.0-64-generic

# dmesg
[    5.120382] usb 2-8: current rate 16000 is different from the runtime rate 48000
[    5.121990] snd_hda_codec_realtek hdaudioC2D0: autoconfig for ALC1220: line_outs=3 (0x14/0x15/0x16/0x0/0x0) type:line
[    5.121992] snd_hda_codec_realtek hdaudioC2D0:    speaker_outs=0 (0x0/0x0/0x0/0x0/0x0)
[    5.121993] snd_hda_codec_realtek hdaudioC2D0:    hp_outs=1 (0x1b/0x0/0x0/0x0/0x0)
[    5.121994] snd_hda_codec_realtek hdaudioC2D0:    mono: mono_out=0x0
[    5.121995] snd_hda_codec_realtek hdaudioC2D0:    dig-out=0x1e/0x0
[    5.121995] snd_hda_codec_realtek hdaudioC2D0:    inputs:
[    5.121997] snd_hda_codec_realtek hdaudioC2D0:      Front Mic=0x19
[    5.121998] snd_hda_codec_realtek hdaudioC2D0:      Rear Mic=0x18
[    5.121998] snd_hda_codec_realtek hdaudioC2D0:      Line=0x1a
[    5.141136] uvcvideo: Found UVC 1.00 device Logitech StreamCam (046d:0893)
[    5.157490] uvcvideo 2-8:1.0: Entity type for entity Processing 3 was not initialized!
[    5.157493] uvcvideo 2-8:1.0: Entity type for entity Extension 14 was not initialized!
[    5.157495] uvcvideo 2-8:1.0: Entity type for entity Extension 6 was not initialized!
[    5.157496] uvcvideo 2-8:1.0: Entity type for entity Extension 8 was not initialized!
[    5.157498] uvcvideo 2-8:1.0: Entity type for entity Extension 9 was not initialized!
[    5.157499] uvcvideo 2-8:1.0: Entity type for entity Extension 10 was not initialized!
[    5.157500] uvcvideo 2-8:1.0: Entity type for entity Extension 11 was not initialized!
[    5.157502] uvcvideo 2-8:1.0: Entity type for entity Camera 1 was not initialized!
[    5.157583] input: Logitech StreamCam as /devices/pci0000:00/0000:00:01.3/0000:02:00.0/usb2/2-8/2-8:1.0/input/input32
[    5.157671] usbcore: registered new interface driver uvcvideo
[    5.157672] USB Video Class driver (1.1.1)

3 février 2021 : Je branche la webcam après le chargement complet de mon ordinateur et voici l'info dmesg :

# dmesg
[  553.490310] usb 2-7: new SuperSpeed Gen 1 USB device number 2 using xhci_hcd
[  553.517111] usb 2-7: New USB device found, idVendor=046d, idProduct=0893, bcdDevice= 3.17
[  553.517114] usb 2-7: New USB device strings: Mfr=0, Product=2, SerialNumber=3
[  553.517116] usb 2-7: Product: Logitech StreamCam
[  553.517118] usb 2-7: SerialNumber: XR6W1K92
[  553.541903] usb 2-7: current rate 16000 is different from the runtime rate 24000
[  553.548111] usb 2-7: current rate 16000 is different from the runtime rate 32000
[  553.554401] usb 2-7: current rate 16000 is different from the runtime rate 48000
[  553.573341] hid-generic 0003:046D:0893.0008: hiddev5,hidraw7: USB HID v1.11 Device [Logitech StreamCam] on usb-0000:02:00.0-7/input5
[  553.629854] videodev: Linux video capture interface: v2.00
[  553.642019] uvcvideo: Found UVC 1.00 device Logitech StreamCam (046d:0893)
[  553.657973] uvcvideo 2-7:1.0: Entity type for entity Processing 3 was not initialized!
[  553.657975] uvcvideo 2-7:1.0: Entity type for entity Extension 14 was not initialized!
[  553.657977] uvcvideo 2-7:1.0: Entity type for entity Extension 6 was not initialized!
[  553.657978] uvcvideo 2-7:1.0: Entity type for entity Extension 8 was not initialized!
[  553.657979] uvcvideo 2-7:1.0: Entity type for entity Extension 9 was not initialized!
[  553.657981] uvcvideo 2-7:1.0: Entity type for entity Extension 10 was not initialized!
[  553.657982] uvcvideo 2-7:1.0: Entity type for entity Extension 11 was not initialized!
[  553.657983] uvcvideo 2-7:1.0: Entity type for entity Camera 1 was not initialized!
[  553.658054] input: Logitech StreamCam as /devices/pci0000:00/0000:00:01.3/0000:02:00.0/usb2/2-7/2-7:1.0/input/input32
[  553.658127] usbcore: registered new interface driver uvcvideo
[  553.658128] USB Video Class driver (1.1.1)
[  553.724131] usb 2-7: current rate 16000 is different from the runtime rate 48000
[  553.737390] usb 2-7: current rate 16000 is different from the runtime rate 48000
[  553.755142] usb 2-7: current rate 16000 is different from the runtime rate 48000

# lsusb
Bus 002 Device 002: ID 046d:0893 Logitech, Inc. Logitech StreamCam

# v4l2-ctl -V
Format Video Capture:
    Width/Height      : 1280/720
    Pixel Format      : 'MJPG' (Motion-JPEG)
    Field             : None
    Bytes per Line    : 0
    Size Image        : 1843200
    Colorspace        : sRGB
    Transfer Function : Default (maps to sRGB)
    YCbCr/HSV Encoding: Default (maps to ITU-R 601)
    Quantization      : Default (maps to Full Range)
    Flags             :

# v4l2-ctl --list-devices
Logitech StreamCam (usb-0000:02:00.0-8):
    /dev/video0
    /dev/video1

# v4l2-ctl --list-formats-ext -d /dev/video0
ioctl: VIDIOC_ENUM_FMT
    Type: Video Capture

    [0]: 'YUYV' (YUYV 4:2:2)
        Size: Discrete 640x480
            Interval: Discrete 0.033s (30.000 fps)
            Interval: Discrete 0.042s (24.000 fps)
            Interval: Discrete 0.050s (20.000 fps)
            Interval: Discrete 0.067s (15.000 fps)
            Interval: Discrete 0.100s (10.000 fps)
            Interval: Discrete 0.133s (7.500 fps)
            Interval: Discrete 0.200s (5.000 fps)
        Size: Discrete 176x144
            Interval: Discrete 0.033s (30.000 fps)
            Interval: Discrete 0.042s (24.000 fps)
            Interval: Discrete 0.050s (20.000 fps)
            Interval: Discrete 0.067s (15.000 fps)
            Interval: Discrete 0.100s (10.000 fps)
            Interval: Discrete 0.133s (7.500 fps)
            Interval: Discrete 0.200s (5.000 fps)
        Size: Discrete 320x240
            Interval: Discrete 0.033s (30.000 fps)
            Interval: Discrete 0.042s (24.000 fps)
            Interval: Discrete 0.050s (20.000 fps)
            Interval: Discrete 0.067s (15.000 fps)
            Interval: Discrete 0.100s (10.000 fps)
            Interval: Discrete 0.133s (7.500 fps)
            Interval: Discrete 0.200s (5.000 fps)
        Size: Discrete 424x240
            Interval: Discrete 0.033s (30.000 fps)
            Interval: Discrete 0.042s (24.000 fps)
            Interval: Discrete 0.050s (20.000 fps)
            Interval: Discrete 0.067s (15.000 fps)
            Interval: Discrete 0.100s (10.000 fps)
            Interval: Discrete 0.133s (7.500 fps)
            Interval: Discrete 0.200s (5.000 fps)
        Size: Discrete 640x360
            Interval: Discrete 0.033s (30.000 fps)
            Interval: Discrete 0.042s (24.000 fps)
            Interval: Discrete 0.050s (20.000 fps)
            Interval: Discrete 0.067s (15.000 fps)
            Interval: Discrete 0.100s (10.000 fps)
            Interval: Discrete 0.133s (7.500 fps)
            Interval: Discrete 0.200s (5.000 fps)
        Size: Discrete 848x480
            Interval: Discrete 0.033s (30.000 fps)
            Interval: Discrete 0.042s (24.000 fps)
            Interval: Discrete 0.050s (20.000 fps)
            Interval: Discrete 0.067s (15.000 fps)
            Interval: Discrete 0.100s (10.000 fps)
            Interval: Discrete 0.133s (7.500 fps)
            Interval: Discrete 0.200s (5.000 fps)
        Size: Discrete 960x540
            Interval: Discrete 0.033s (30.000 fps)
            Interval: Discrete 0.042s (24.000 fps)
            Interval: Discrete 0.050s (20.000 fps)
            Interval: Discrete 0.067s (15.000 fps)
            Interval: Discrete 0.100s (10.000 fps)
            Interval: Discrete 0.133s (7.500 fps)
            Interval: Discrete 0.200s (5.000 fps)
        Size: Discrete 1280x720
            Interval: Discrete 0.033s (30.000 fps)
            Interval: Discrete 0.042s (24.000 fps)
            Interval: Discrete 0.050s (20.000 fps)
            Interval: Discrete 0.067s (15.000 fps)
            Interval: Discrete 0.100s (10.000 fps)
            Interval: Discrete 0.133s (7.500 fps)
            Interval: Discrete 0.200s (5.000 fps)
        Size: Discrete 1600x896
            Interval: Discrete 0.033s (30.000 fps)
            Interval: Discrete 0.042s (24.000 fps)
            Interval: Discrete 0.050s (20.000 fps)
            Interval: Discrete 0.067s (15.000 fps)
            Interval: Discrete 0.100s (10.000 fps)
            Interval: Discrete 0.133s (7.500 fps)
            Interval: Discrete 0.200s (5.000 fps)
        Size: Discrete 1920x1080
            Interval: Discrete 0.033s (30.000 fps)
            Interval: Discrete 0.042s (24.000 fps)
            Interval: Discrete 0.050s (20.000 fps)
            Interval: Discrete 0.067s (15.000 fps)
            Interval: Discrete 0.100s (10.000 fps)
            Interval: Discrete 0.133s (7.500 fps)
            Interval: Discrete 0.200s (5.000 fps)
        Size: Discrete 2304x1296
            Interval: Discrete 0.200s (5.000 fps)
    [1]: 'MJPG' (Motion-JPEG, compressed)
        Size: Discrete 640x480
            Interval: Discrete 0.017s (60.000 fps)
            Interval: Discrete 0.033s (30.000 fps)
            Interval: Discrete 0.042s (24.000 fps)
            Interval: Discrete 0.050s (20.000 fps)
            Interval: Discrete 0.067s (15.000 fps)
            Interval: Discrete 0.100s (10.000 fps)
            Interval: Discrete 0.133s (7.500 fps)
            Interval: Discrete 0.200s (5.000 fps)
        Size: Discrete 176x144
            Interval: Discrete 0.017s (60.000 fps)
            Interval: Discrete 0.033s (30.000 fps)
            Interval: Discrete 0.042s (24.000 fps)
            Interval: Discrete 0.050s (20.000 fps)
            Interval: Discrete 0.067s (15.000 fps)
            Interval: Discrete 0.100s (10.000 fps)
            Interval: Discrete 0.133s (7.500 fps)
            Interval: Discrete 0.200s (5.000 fps)
        Size: Discrete 320x240
            Interval: Discrete 0.017s (60.000 fps)
            Interval: Discrete 0.033s (30.000 fps)
            Interval: Discrete 0.042s (24.000 fps)
            Interval: Discrete 0.050s (20.000 fps)
            Interval: Discrete 0.067s (15.000 fps)
            Interval: Discrete 0.100s (10.000 fps)
            Interval: Discrete 0.133s (7.500 fps)
            Interval: Discrete 0.200s (5.000 fps)
        Size: Discrete 424x240
            Interval: Discrete 0.017s (60.000 fps)
            Interval: Discrete 0.033s (30.000 fps)
            Interval: Discrete 0.042s (24.000 fps)
            Interval: Discrete 0.050s (20.000 fps)
            Interval: Discrete 0.067s (15.000 fps)
            Interval: Discrete 0.100s (10.000 fps)
            Interval: Discrete 0.133s (7.500 fps)
            Interval: Discrete 0.200s (5.000 fps)
        Size: Discrete 640x360
            Interval: Discrete 0.017s (60.000 fps)
            Interval: Discrete 0.033s (30.000 fps)
            Interval: Discrete 0.042s (24.000 fps)
            Interval: Discrete 0.050s (20.000 fps)
            Interval: Discrete 0.067s (15.000 fps)
            Interval: Discrete 0.100s (10.000 fps)
            Interval: Discrete 0.133s (7.500 fps)
            Interval: Discrete 0.200s (5.000 fps)
        Size: Discrete 848x480
            Interval: Discrete 0.017s (60.000 fps)
            Interval: Discrete 0.033s (30.000 fps)
            Interval: Discrete 0.042s (24.000 fps)
            Interval: Discrete 0.050s (20.000 fps)
            Interval: Discrete 0.067s (15.000 fps)
            Interval: Discrete 0.100s (10.000 fps)
            Interval: Discrete 0.133s (7.500 fps)
            Interval: Discrete 0.200s (5.000 fps)
        Size: Discrete 960x540
            Interval: Discrete 0.017s (60.000 fps)
            Interval: Discrete 0.033s (30.000 fps)
            Interval: Discrete 0.042s (24.000 fps)
            Interval: Discrete 0.050s (20.000 fps)
            Interval: Discrete 0.067s (15.000 fps)
            Interval: Discrete 0.100s (10.000 fps)
            Interval: Discrete 0.133s (7.500 fps)
            Interval: Discrete 0.200s (5.000 fps)
        Size: Discrete 1280x720
            Interval: Discrete 0.017s (60.000 fps)
            Interval: Discrete 0.033s (30.000 fps)
            Interval: Discrete 0.042s (24.000 fps)
            Interval: Discrete 0.050s (20.000 fps)
            Interval: Discrete 0.067s (15.000 fps)
            Interval: Discrete 0.100s (10.000 fps)
            Interval: Discrete 0.133s (7.500 fps)
            Interval: Discrete 0.200s (5.000 fps)
        Size: Discrete 1600x896
            Interval: Discrete 0.017s (60.000 fps)
            Interval: Discrete 0.033s (30.000 fps)
            Interval: Discrete 0.042s (24.000 fps)
            Interval: Discrete 0.050s (20.000 fps)
            Interval: Discrete 0.067s (15.000 fps)
            Interval: Discrete 0.100s (10.000 fps)
            Interval: Discrete 0.133s (7.500 fps)
            Interval: Discrete 0.200s (5.000 fps)
        Size: Discrete 1920x1080
            Interval: Discrete 0.017s (60.000 fps)
            Interval: Discrete 0.033s (30.000 fps)
            Interval: Discrete 0.042s (24.000 fps)
            Interval: Discrete 0.050s (20.000 fps)
            Interval: Discrete 0.067s (15.000 fps)
            Interval: Discrete 0.100s (10.000 fps)
            Interval: Discrete 0.133s (7.500 fps)
            Interval: Discrete 0.200s (5.000 fps)
    [2]: 'NV12' (Y/CbCr 4:2:0)
        Size: Discrete 640x480
            Interval: Discrete 0.033s (30.000 fps)
            Interval: Discrete 0.042s (24.000 fps)
            Interval: Discrete 0.050s (20.000 fps)
            Interval: Discrete 0.067s (15.000 fps)
            Interval: Discrete 0.100s (10.000 fps)
            Interval: Discrete 0.133s (7.500 fps)
            Interval: Discrete 0.200s (5.000 fps)
        Size: Discrete 640x360
            Interval: Discrete 0.033s (30.000 fps)
            Interval: Discrete 0.042s (24.000 fps)
            Interval: Discrete 0.050s (20.000 fps)
            Interval: Discrete 0.067s (15.000 fps)
            Interval: Discrete 0.100s (10.000 fps)
            Interval: Discrete 0.133s (7.500 fps)
            Interval: Discrete 0.200s (5.000 fps)
        Size: Discrete 1280x720
            Interval: Discrete 0.033s (30.000 fps)
            Interval: Discrete 0.042s (24.000 fps)
            Interval: Discrete 0.050s (20.000 fps)
            Interval: Discrete 0.067s (15.000 fps)
            Interval: Discrete 0.100s (10.000 fps)
            Interval: Discrete 0.133s (7.500 fps)
            Interval: Discrete 0.200s (5.000 fps)
        Size: Discrete 1920x1080
            Interval: Discrete 0.033s (30.000 fps)
            Interval: Discrete 0.042s (24.000 fps)
            Interval: Discrete 0.050s (20.000 fps)
            Interval: Discrete 0.067s (15.000 fps)
            Interval: Discrete 0.100s (10.000 fps)
            Interval: Discrete 0.133s (7.500 fps)
            Interval: Discrete 0.200s (5.000 fps)

1voto

John Miller Points 51

J'avais une hypothèse et après avoir testé mon idée, elle a fonctionné.

J'ai pensé que le problème pouvait être que ma carte mère ou le système d'exploitation Xubuntu ne gérait pas correctement la connexion USB-C directe. J'ai donc acheté un adaptateur USB-C vers USB-A, important qu'il soit 3.0 pour avoir un taux de transfert de données élevé. Maintenant, tout fonctionne correctement pour moi.

Je n'ai pas de réponse à la question de savoir quel était le problème, mais j'ai trouvé une solution. J'espère qu'elle pourra aider d'autres utilisateurs qui ont le même problème ;)

SistemesEz.com

SystemesEZ est une communauté de sysadmins où vous pouvez résoudre vos problèmes et vos doutes. Vous pouvez consulter les questions des autres sysadmins, poser vos propres questions ou résoudre celles des autres.

Powered by:

X