作为网络摄像头的无反光镜相机 - Sony A5100 和 ElGato Camlink 4K

作为网络摄像头的无反光镜相机 - Sony A5100 和 ElGato Camlink 4K

我正在努力让我的索尼A5100作为网络摄像头工作Linux, 具体来说软呢帽 325.11.22-100.fc32.x86_64内核上。可能是时候升级了,但我想我应该先在这里查询一下,看看是否有什么地方我做错了。

下列的互联网上的指南我已经安装了一些东西,包括v4l2loopback模块ffmpeg等。使用以下脚本:

#! /bin/bash

log() {
    echo "## $1" >&2
}

confirm() {
    read -r -p "## ${1}? [y/N] " response

    [ ${response:-N} = y ] && return 0 || return 1
}

log "Loading kernel module"
sudo modprobe v4l2loopback devices=1 exclusive_caps=1

log "Listing devices"
v4l2-ctl --list-devices

log "Finding device"
device=$(lsusb | grep -i elgato)

if [ -z "$device" ]; then
    log "No device found"
    exit 1
else
    log "Found USB device '$device'"
fi

if confirm "Reset USB"; then
    bus=$(echo "$device" | awk '{ print $2 }')
    dev=$(echo "$device" | awk '{ print $4 }' | sed 's/://g')

    log "Resetting USB bus=$bus dev=$dev"
    sudo ${HOME}/projects/usbreset/usbreset "/dev/bus/usb/${bus}/${dev}"
else
    log "Not resetting USB"
fi

if confirm "Flush buffers"; then
    log "Flushing buffers"
    sudo modprobe -v -r uvcvideo && sudo modprobe -v uvcvideo
else
    log "Not resetting USB"
fi

video=($(ls /dev/video*))

select choice in "${video[@]}"; do
    log "Selected '$choice'"

    log "Listing video formats"
    v4l2-ctl -d $choice --get-fmt-video

    log "Start playback"
    ffplay -pixel_format yuyv422 $choice
    break
done

(注意usbreset脚本来自这里)我有一个一致的方法来显示单帧,但我无法让相机传输视频。 USB 设置、电缆、采集卡、相机设置等都工作正常视窗,但是再次遇到问题Linux

上述脚本的输出,称为cam,此处:

./cam
## Loading kernel module
## Listing devices
OBS Virtual Camera (platform:v4l2loopback-000):
        /dev/video0

Cam Link 4K: Cam Link 4K (usb-0000:00:14.0-4.3):
        /dev/video3
        /dev/video4

Integrated Camera: Integrated C (usb-0000:00:14.0-8):
        /dev/video1
        /dev/video2

## Finding device
## Found USB device 'Bus 002 Device 007: ID 0fd9:0066 Elgato Systems GmbH USB 10/100/1000 LAN'
## Reset USB? [y/N] y
## Resetting USB bus=002 dev=007
Resetting USB device /dev/bus/usb/002/007
Reset successful
## Flush buffers? [y/N] y
## Flushing buffers
rmmod uvcvideo
rmmod videobuf2_v4l2
rmmod videobuf2_common
rmmod videobuf2_vmalloc
rmmod videobuf2_memops
insmod /lib/modules/5.11.22-100.fc32.x86_64/kernel/drivers/media/common/videobuf2/videobuf2-common.ko.xz
insmod /lib/modules/5.11.22-100.fc32.x86_64/kernel/drivers/media/common/videobuf2/videobuf2-v4l2.ko.xz
insmod /lib/modules/5.11.22-100.fc32.x86_64/kernel/drivers/media/common/videobuf2/videobuf2-memops.ko.xz
insmod /lib/modules/5.11.22-100.fc32.x86_64/kernel/drivers/media/common/videobuf2/videobuf2-vmalloc.ko.xz
insmod /lib/modules/5.11.22-100.fc32.x86_64/kernel/drivers/media/usb/uvc/uvcvideo.ko.xz
1) /dev/video0
2) /dev/video1
3) /dev/video2
4) /dev/video3
5) /dev/video4
#? 4
## Selected '/dev/video3'
## Listing video formats
Format Video Capture:
        Width/Height      : 1920/1080
        Pixel Format      : 'YUYV' (YUYV 4:2:2)
        Field             : None
        Bytes per Line    : 3840
        Size Image        : 4147200
        Colorspace        : sRGB
        Transfer Function : Rec. 709
        YCbCr/HSV Encoding: Rec. 709
        Quantization      : Default (maps to Limited Range)
        Flags             :
## Start playback
ffplay version 4.2.4 Copyright (c) 2003-2020 the FFmpeg developers
  built with gcc 10 (GCC)
  configuration: --prefix=/usr --bindir=/usr/bin --datadir=/usr/share/ffmpeg --docdir=/usr/share/doc/ffmpeg --incdir=
mat-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-swi
fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection' --extra-ldflags='-Wl,-z,relro -Wl,--as-needed -
core-amrwb --enable-libvo-amrwbenc --enable-version3 --enable-bzlib --disable-crystalhd --enable-fontconfig --enable-
ray --enable-libcdio --enable-libdrm --enable-libjack --enable-libfreetype --enable-libfribidi --enable-libgsm --enab
nable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-libsrt --enable-libsoxr --enable-libspe
version3 --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-libxml2 --enable-libzimg --enabl
isable-static --enable-shared --enable-gpl --disable-debug --disable-stripping --shlibdir=/usr/lib64 --enable-libmfx
  libavutil      56. 31.100 / 56. 31.100
  libavcodec     58. 54.100 / 58. 54.100
  libavformat    58. 29.100 / 58. 29.100
  libavdevice    58.  8.100 / 58.  8.100
  libavfilter     7. 57.100 /  7. 57.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  5.100 /  5.  5.100
  libswresample   3.  5.100 /  3.  5.100
  libpostproc    55.  5.100 / 55.  5.100
Input #0, video4linux2,v4l2, from '/dev/video3':B sq=    0B f=0/0
  Duration: N/A, start: 2085.401686, bitrate: 1988671 kb/s
    Stream #0:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 1920x1080, 1988671 kb/s, 59.94 fps, 59.94 tbr, 1000k t
X connection to :0 broken (explicit kill or server shutdown).=0/0

有时,通常在获得“成功”单帧后,我会收到一条消息,指出:

[video4linux2,v4l2 @ 0x7fc034000c80] Dequeued v4l2 buffer contains corrupted data (0 bytes).
Input #0, video4linux2,v4l2, from '/dev/video3':
  Duration: N/A, start: 300.727603, bitrate: 1988671 kb/s
  Stream #0:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 1920x1080, 1988671 kb/s, 59.94 fps, 59.94 tbr, 1000k tbn, 1000k tbc
[video4linux2,v4l2 @ 0x7fc034000c80] Dequeued v4l2 buffer contains corrupted data (0 bytes).
    Last message repeated 158 times

请注意,同样的事情也会发生在类似的事情中OBS,飞涨, ETC。


总长DR: 一切似乎尝试使用我的时有效索尼A5100作为网络摄像头埃尔加托 Camlink 4K(设备以正确的格式显示,等等)但我只能显示一个帧。视频流正常开启视窗使用当前相机设置。

相关内容