1

我最近更换了 PC,从配备集成显卡的 Intel Core i5 4460 变为配备 AMD RADEON RX 550 显卡的 Xeon E5 2678 v3。

在纸面上,新 PC 的性能是旧 PC 的 3 到 7 倍,我可以证明在日常使用、视频和图像编辑等方面就是这种情况。拥有这么多内核和线程的优势是明显的。在游戏方面我没有尝试过,因为我不是真正的游戏玩家,而且我使用的少数游戏是 Debian 和一些模拟器附带的典型免费游戏,老实说,它们已经在旧 PC 上运行良好。

然而,有一项任务因其糟糕的性能而让我大吃一惊:视频屏幕捕获。

使用我的旧电脑,我能够在执行任何需要录制的任务时以超过 60 fps 的速度全屏拍摄。

即使使用我的联想 thinkpad x230,我也能够以超过 80fps 的速度完全流畅地捕捉屏幕。

我一直使用的命令是:

ffmpeg  -f x11grab -draw_mouse 1 -framerate 60 -video_size 1920x1200 -i :0.0+1680,0  -qscale 0 -pix_fmt yuv420p -c:v libx264 -preset medium -qp 0 -q:v 1 -s 1920x1200 -f matroska -threads 4 video.mkv

笔记:

-video_size 1920x1200 -i :0.0+1680,0 y -s 1920x1200 是要捕获的区域的尺寸和位置(我的右显示器)。

请注意,我什至使用了 -preset 媒体和软件编码,因此即使使用该参数设置,我也获得了非常好的质量,并且从未低于 60 fps。

我现在怎么了?

该设备无法捕获超过 20 fps 的视频,这使得任何视频都无效,出现丢帧甚至达不到 30 fps,这将是最低要求。

此外,当我启动命令时,PC 的响应能力下降非常明显。也就是说,正常工作时所欣赏的所有流动性和平滑性都会消失,甚至将窗户从一侧移动到另一侧都是粗糙和绊脚石。

我尝试使用 ffmpeg 的不同参数来捕获原始数据,无需编码。

我尝试将生成的视频直接保存到 RAM 磁盘,以避免写入磁盘可能出现的瓶颈。它根本不影响它。

那么,是否有人对至少我可以在哪里进一步挖掘以找到问题的解决方案有任何建议?

附加数据,以防有帮助:

$ → inxi
CPU: 12-Core Intel Xeon E5-2678 v3 (-MT MCP-)
speed/min/max: 1201/1200/3300 MHz Kernel: 5.10.0-0.bpo.4-amd64 x86_64
Up: 1d 6h 55m Mem: 6427.6/32012.4 MiB (20.1%)
Storage: 13.76 TiB (55.9% used) Procs: 433 Shell: bash 5.0.18 inxi: 3.0.32


$ → ffmpeg -v
ffmpeg version 4.1.6 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 8 (Debian 8.3.0-6)
  configuration: --disable-decoder=amrnb --disable-decoder=libopenjpeg --disable-libopencv --disable-outdev=sdl2 --disable-podpages --disable-sndio --disable-stripping --enable-libaom --enable-avfilter --enable-avresample --enable-gcrypt --disable-gnutls --enable-openssl --enable-gpl --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libfdk-aac --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libilbc --enable-libkvazaar --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libx265 --enable-libzimg --enable-libxvid --enable-libzvbi --enable-nonfree --enable-opencl --enable-opengl --enable-postproc --enable-pthreads --enable-shared --enable-version3 --enable-libwebp --incdir=/usr/include/x86_64-linux-gnu --libdir=/usr/lib/x86_64-linux-gnu --prefix=/usr --toolchain=hardened --enable-frei0r --enable-chromaprint --enable-libx264 --enable-libiec61883 --enable-libdc1394 --enable-vaapi --enable-libmfx --enable-libvmaf --disable-altivec --shlibdir=/usr/lib/x86_64-linux-gnu
  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

我有免费的 amdgpu 驱动程序(不是 amdgpu-pro),但我激活了 opencl 以防万一。

我遵循了本教程:

https://linuxconfig.org/how-to-install-the-latest-amd-drivers-on-debian-10-buster

$ → glxinfo | grep OpenGL
OpenGL vendor string: AMD
OpenGL renderer string: Radeon RX550/550 Series (POLARIS12, DRM 3.40.0, 5.10.0-0.bpo.4-amd64, LLVM 11.0.1)
OpenGL core profile version string: 4.6 (Core Profile) Mesa 20.3.4
OpenGL core profile shading language version string: 4.60
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL core profile extensions:
OpenGL version string: 4.6 (Compatibility Profile) Mesa 20.3.4
OpenGL shading language version string: 4.60
OpenGL context flags: (none)
OpenGL profile mask: compatibility profile
OpenGL extensions:
OpenGL ES profile version string: OpenGL ES 3.2 Mesa 20.3.4
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20
OpenGL ES profile extensions:





$ → clinfo
Number of platforms                               1
  Platform Name                                   Clover
  Platform Vendor                                 Mesa
  Platform Version                                OpenCL 1.1 Mesa 20.3.4
  Platform Profile                                FULL_PROFILE
  Platform Extensions                             cl_khr_icd
  Platform Extensions function suffix             MESA

  Platform Name                                   Clover
Number of devices                                 1
  Device Name                                     Radeon RX550/550 Series (POLARIS12, DRM 3.40.0, 5.10.0-0.bpo.4-amd64, LLVM 11.0.1)
  Device Vendor                                   AMD
  Device Vendor ID                                0x1002
  Device Version                                  OpenCL 1.1 Mesa 20.3.4
  Driver Version                                  20.3.4
  Device OpenCL C Version                         OpenCL C 1.1
  Device Type                                     GPU
  Device Profile                                  FULL_PROFILE
  Device Available                                Yes
  Compiler Available                              Yes
  Max compute units                               8
  Max clock frequency                             1183MHz
  Max work item dimensions                        3
  Max work item sizes                             256x256x256
  Max work group size                             256
  Preferred work group size multiple              64
  Preferred / native vector sizes
    char                                                16 / 16
    short                                                8 / 8
    int                                                  4 / 4
    long                                                 2 / 2
    half                                                 0 / 0        (n/a)
    float                                                4 / 4
    double                                               2 / 2        (cl_khr_fp64)
  Half-precision Floating-point support           (n/a)
  Single-precision Floating-point support         (core)
    Denormals                                     No
    Infinity and NANs                             Yes
    Round to nearest                              Yes
    Round to zero                                 No
    Round to infinity                             No
    IEEE754-2008 fused multiply-add               No
    Support is emulated in software               No
    Correctly-rounded divide and sqrt operations  No
  Double-precision Floating-point support         (cl_khr_fp64)
    Denormals                                     Yes
    Infinity and NANs                             Yes
    Round to nearest                              Yes
    Round to zero                                 Yes
    Round to infinity                             Yes
    IEEE754-2008 fused multiply-add               Yes
    Support is emulated in software               No
  Address bits                                    64, Little-Endian
  Global memory size                              3221225472 (3GiB)
  Error Correction support                        No
  Max memory allocation                           1717986918 (1.6GiB)
  Unified memory for Host and Device              No
  Minimum alignment for any data type             128 bytes
  Alignment of base address                       32768 bits (4096 bytes)
  Global Memory cache type                        None
  Image support                                   No
  Local memory type                               Local
  Local memory size                               32768 (32KiB)
  Max number of constant args                     16
  Max constant buffer size                        67108864 (64MiB)
  Max size of kernel argument                     1024
  Queue properties
    Out-of-order execution                        No
    Profiling                                     Yes
  Profiling timer resolution                      0ns
  Execution capabilities
    Run OpenCL kernels                            Yes
    Run native kernels                            No
  Device Extensions cl_khr_byte_addressable_store cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_int64_base_atomics cl_khr_int64_extended_atomics cl_khr_fp64

NULL platform behavior
  clGetPlatformInfo(NULL, CL_PLATFORM_NAME, ...)  Clover
  clGetDeviceIDs(NULL, CL_DEVICE_TYPE_ALL, ...)   Success [MESA]
  clCreateContext(NULL, ...) [default]            Success [MESA]
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_DEFAULT)  Success (1)
    Platform Name                                 Clover
    Device Name                                   Radeon RX550/550 Series (POLARIS12, DRM 3.40.0, 5.10.0-0.bpo.4-amd64, LLVM 11.0.1)
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_CPU)  No devices found in platform
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_GPU)  Success (1)
    Platform Name                                 Clover
    Device Name                                   Radeon RX550/550 Series (POLARIS12, DRM 3.40.0, 5.10.0-0.bpo.4-amd64, LLVM 11.0.1)
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_ACCELERATOR)  No devices found in platform
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_CUSTOM)  No devices found in platform
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_ALL)  Success (1)
    Platform Name                                 Clover
    Device Name                                   Radeon RX550/550 Series (POLARIS12, DRM 3.40.0, 5.10.0-0.bpo.4-amd64, LLVM 11.0.1)

ICD loader properties
  ICD loader Name                                 OpenCL ICD Loader
  ICD loader Vendor                               OCL Icd free software
  ICD loader Version                              2.2.12
  ICD loader Profile                              OpenCL 2.2

这不会是撕裂问题,因为播放视频时看不到撕裂并且启用了 TearFree 驱动程序策略。

$ → xrandr --verbose | grep TearFree
    TearFree: on
    TearFree: on
    TearFree: on

非常比你。;)

4

0 回答 0