Obs linux hardware acceleration

Obs linux hardware acceleration

Hey guys. I’m trying to use hardware acceleration to encode my OBS recordings on Linux. I have a Radeon R9 270. When I use «vainfo», I get the following output:

[lukas@lukas-pc ~]$ vainfo vainfo: VA-API version: 1.12 (libva 2.12.0) vainfo: Driver version: Mesa Gallium driver 21.1.5 for AMD Radeon(TM) HD8800 Series (PITCAIRN, DRM 3.40.0, 5.10.53-1-MANJARO, LLVM 12.0.1) vainfo: Supported profile and entrypoints VAProfileMPEG2Simple : VAEntrypointVLD VAProfileMPEG2Main : VAEntrypointVLD VAProfileVC1Simple : VAEntrypointVLD VAProfileVC1Main : VAEntrypointVLD VAProfileVC1Advanced : VAEntrypointVLD VAProfileH264ConstrainedBaseline: VAEntrypointVLD VAProfileH264Main : VAEntrypointVLD VAProfileH264High : VAEntrypointVLD VAProfileNone : VAEntrypointVideoProc

As you can see, there is no «VAEntrypointEncSlice» entry, which I take as meaning I don’t have the option to encode on my GPU, as «VAEntrypointEncSlice means that you can encode to this format». But upon reading further on https://wiki.archlinux.org/title/Hardware_video_acceleration#Configuring_VA-API , they show a table where H.264/MPEG-4 AVC encoding is available on Radeon HD 7000 and newer cards, so I don’t know if I am still able to somehow be able to.

By the way, this is the initial error I found in the logs upon trying to record in OBS:

warning: [FFMPEG VAAPI encoder: ‘recording_h264’] Failed to open VAAPI codec: Function not implemented info: ——————————— info: [FFMPEG VAAPI encoder: ‘recording_h264’] settings: device: /dev/dri/renderD128 rate_control: CBR profile: 77 level: 40 qp: 0 bitrate: 2500 maxrate: 2500 keyint: 120 width: 1920 height: 1080 b-frames: 0 [h264_vaapi @ 0x55594781b8c0] No usable encoding entrypoint found for profile VAProfileH264Main (6). warning: [FFMPEG VAAPI encoder: ‘recording_h264’] Failed to open VAAPI codec: Function not implemented

Any help or pointing in the correct direction would be greatly appreciated. Thanks guys.

Источник

Open Broadcaster Software

Open Broadcaster Software (OBS) is an open source cross-platform video recording and live-streaming application. It provides an easy to pick up and extensible workflow with customizable scenes, volume mixers, transitions, filters and more.

Installation

OBS can be installed with the obs-studio package, or obs-studio-git AUR for the development version.

Читайте также:  Threads example in linux

Other clients that provide other functionality are available:

Configuration

For easy configuration, Tools > Auto-Configuration Wizard can quickly set up base settings for both recording and live-streaming. The wizard auto-selects bitrate, resolution and encoder based on your hardware (and network connection if streaming was set up).

Hardware video acceleration

Hardware-accelerated encoding and decoding is best for performance, CPU/GPU usage and quality. The encoder can be changed in Settings > Output > Streaming > Encoder (may have to first set Settings > Output > Output Mode to Advanced). See Hardware video acceleration if a hardware encoder is not detected.

Recording output

By default, OBS will output recordings in the user’s home path with spaces in the video filename and the same encoder selected for streaming. The output path, filesize, file format, filename style and more can be changed in Settings > Output > Streaming > Encoder.

Hotkeys

By default, OBS assigns no hotkeys. All hotkey pairs highlighted in red upon selection can use the same keybind for toggling the pair’s function.

Virtual camera output

Starting from version 26.1, OBS supports virtual camera output on Linux. To use it, install v4l2loopback, then the Start Virtual Camera button will appear in OBS. If the v4l2loopback kernel module is not loaded yet, OBS will automatically try to load it and ask for administrative privileges to do so (using pkexec(1) ).

Wayland

Since OBS is a Qt application, see Wayland#Qt to make it work under Wayland. See PipeWire#WebRTC screen sharing to enable Wayland screen capture.

Global shortcuts in KDE not working

The global shortcuts set in OBS only work when OBS is in focus. As a workaround, you can control OBS through its WebSocket interface, which can be enabled in OBS by going to Tools > WebSocket Server Settings and selecting Enable WebSocket server.

Note: obs-studio is still missing WebSocket support FS#76710, but the Flatpak and some of the AUR packages do have it.

The WebSocket can then be controlled with obsws-python or obs-websocket-py (version >=1.0). Either of them can be installed with pip. Then in System Settings > Shortcuts, you can add the following command for obsws-python to set your custom shortcut to toggle recording:

Читайте также:  Выпустить сертификат ssl linux

This article or section needs language, wiki syntax or style improvements. See Help:Style for reference.

python -c "import obsws_python;obsws_python.ReqClient(host='localhost',port=4455,password='yourwebsocketpassword').toggle_record()"

Or the following command if you’re using obs-websocket-py :

python -c "from obswebsocket import obsws,requests;c=obsws('localhost',4455,'yourwebsocketpassword');c.connect();c.call(requests.ToggleRecord());c.disconnect()"

The WebSocket password and port can be found in WebSocket Server Settings > Show Connect Info.

Tips and tricks

Browser source

The obs-browser plugin gives the ability to use a webpage within the canvas, typically for web-based overlays. The webpage can be interacted with and works like any other source type.

The default obs-studio package does not provide this plugin. It can be added via other clients or plugin packages:

  • obs-studio-gitAUR compiles with the browser plugin.
  • obs-linuxbrowserAUR (or obs-linuxbrowser-binAUR for pre-compiled binary) provides the old linuxbrowser plugin. Works with the default client, but is abandoned and slightly outdated. The quickest way to get the plugin as of December 2021.
  • obs-studio-tytan652AUR is a custom client that provides the browser plugin as well as browser docks, along with other general improvements.

Capturing via Vulkan/OpenGL

The obs-vkcapture plugin adds the capability to capture Vulkan or OpenGL programs by hooking into those APIs directly, rather than using generic Xorg or Wayland window capture APIs. To use it, install obs-vkcapture AUR , as well as lib32-obs-vkcapture AUR if capturing 32-bit applications. Follow the instructions in the GitHub repository to setup a Game Capture using the plugin.

Encoding using GStreamer

obs-gstreamer is a project which provides:

  • An encoder plugin for using GStreamer for encoding.
  • Plugins for using a GStreamer pipeline as a source, video filter, or audio filter. This is an advanced capability intended for users familiar with GStreamer usage.

AMD GPU users report that VA-API via GStreamer outperforms OBS’s default VA-API video encoding capabilities. To use obs-gstreamer for encoding, install obs-gstreamer AUR and change OBS’ encoder to GStreamer Encoder. If OBS gives an error regarding encoders you might need to install the gstreamer-vaapi package.

Encoding using AMF

obs-studio-amf is a patch that ports the AMD Media Framework encoder to Linux, which was previously exclusive to Windows.

To make this work you need to setup AMDGPU PRO, install obs-studio-amf AUR and set the VK_ICD_FILENAMES environment variable:

$ VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/amd_pro_icd64.json:/usr/share/vulkan/icd.d/amd_pro_icd32.json obs

With the most recent graphics drivers, AMF should outperform any hardware encoder for AMD in both speed and quality.

Читайте также:  Linux get file attributes

Manual plugins installation

You can manually install plugin to the ~/.config/obs-studio/plugins/ . The folder structure is the following:

~/.config/obs-studio/plugins/plugin_name/bin/64-bit/plugin_name.so ~/.config/obs-studio/plugins/plugin_name/data/locale/en-US.ini

See also

Источник

Аппаратное кодирование в obs-studio на открытый драйверах amd.

median avatar

Так и я не особо профи, иначе бы я сам разобрался в проблеме, просто хочется что бы линукс пользователи не были обделены преимуществами виндовс пользователей в плане стримов.

Это для меня вообще темный лес (в молодые годы этого ничего не было) — что можно почитать на эту тему для общего ликбеза.

Так и запишем: пи*деж не было.

median
просто хочется что бы линукс пользователи не были обделены преимуществами виндовс пользователей в плане стримов.

median avatar

ffmpeg собирать надо с поддержкой и параметры передавать
https://gist.github.com/Brainiarc7/95c9338a737aa36d9bb2931bed379219 Вы сами то смотрели ссыль что скинули ? Using VAAPI’s hardware accelerated video encoding on Linux with Intel’s hardware on FFmpeg and libav , это для оборудования на intel, у меня amd, я вроде бы ни где не указывал что у меня intel.

Extra notes for AMD hardware supporting VCE:

If you have a supported GCN+ AMD GPU running on Linux with the mesa driver stack, you may be able to use the AMD VCE Block via VAAPI with an example such as the one shown below:

DRI_PRIME=1 LIBVA_DRIVER_NAME=radeonsi ffmpeg -hwaccel vaapi -vaapi_device /dev/dri/renderD128 -hwaccel_output_format vaapi \
-framerate 30 -video_size 1920×1200 -f x11grab -i :0.0 -f pulse -ac 2 -i 1 \
-vf ‘format=nv12,hwupload’ -threads 8 \
-vcodec h264_vaapi -bf 0 -acodec pcm_s16le output.mkv
Where we capture from the screen via x11grab and the audio from a pulseaudio device.

You must set the LIBVA_DRIVER_NAME and the DRI_PRIME=1 environment variables to radeonsi prior to using VAAPI on VCE, and ensure that the -vaapi_device points to the correct renderer.

Note that with AMD hardware, we generally disable B-Frame support as newer SKUs such as the RX 460/470/480 and their rebrands (Polaris-based) do not support B-Frames in H.264 encoding. See this issue on Github for more details.

Источник

Оцените статью
Adblock
detector