Open Broadcaster Software: Difference between revisions

From ArchWiki
(→‎Tips and tricks: Manual plugins installation)
(update Pkg/AUR templates)
 
(48 intermediate revisions by 18 users not shown)
Line 5: Line 5:
[[zh-hans:Open Broadcaster Software]]
[[zh-hans:Open Broadcaster Software]]
{{Related articles start}}
{{Related articles start}}
{{Related|Streaming to twitch.tv}}
{{Related|FFmpeg}}
{{Related articles end}}
{{Related articles end}}


Line 12: Line 12:
== Installation ==
== Installation ==


OBS can be [[install]]ed with the {{Pkg|obs-studio}} package, or {{AUR|obs-studio-git}} for the development version.
{{Style|Use [[Template:App]] to explain what each package does differently.}}


Other clients that provide other functionality are available:
[[Install]] one of the following packages:


* {{Pkg|obs-studio}} - latest OBS release.
* {{AUR|obs-studio-git}} - latest commit to master.
* {{AUR|obs-studio-tytan652}}
* {{AUR|obs-studio-tytan652}}
* {{AUR|obs-studio-browser}}
* {{AUR|obs-studio-browser}}
* {{AUR|obs-studio-minimal}}
* {{AUR|obs-studio-amf}}
* {{AUR|obs-hevc-vaapi-git}}


== Configuration ==
== Configuration ==
Line 39: Line 40:
=== Virtual camera output ===
=== Virtual camera output ===


Starting from version 26.1, OBS supports virtual camera output on Linux. To use it, [[install]] the {{Pkg|v4l2loopback-dkms}} package and add your user to the {{ic|video}} group, then the ''Start Virtual Camera'' button will appear in OBS. If the {{ic|v4l2loopback}} [[kernel module]] is not loaded yet, OBS will automatically try to load it and ask for administrative privileges to do so (using {{man|1|pkexec}}).
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 {{ic|v4l2loopback}} [[kernel module]] is not loaded yet, OBS will automatically try to load it and ask for administrative privileges to do so (using {{man|1|pkexec}}).


=== Wayland ===
=== 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.
Since OBS is a Qt application, see [[Wayland#Qt]] to make it work under Wayland. OBS has [https://github.com/obsproject/obs-studio/discussions/6481 upgraded from Qt 5 to Qt 6] since version 28, so installation of {{Pkg|qt6-wayland}} is required for the newer versions. 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|{{ic|obs-studio}} is still missing WebSocket support {{Bug|76710}}, but the [[Flatpak]] and some of the AUR packages do have it (for example, {{AUR|obs-studio-git}}).}}
 
The WebSocket can then be controlled with {{ic|[https://github.com/aatikturk/obsws-python obsws-python]}} or {{ic|[https://github.com/Elektordi/obs-websocket-py 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 {{ic|obsws-python}} to set your custom shortcut to toggle recording:
 
{{Style|Avoid complex one-liners.}}
 
python -c "import obsws_python;obsws_python.ReqClient(host='localhost',port=4455,password='''yourwebsocketpassword''<nowiki/>').toggle_record()"
 
Or the following command if you're using {{ic|obs-websocket-py}}:
 
python -c "from obswebsocket import obsws,requests;c=obsws('localhost',4455,'''yourwebsocketpassword''<nowiki/>');c.connect();c.call(requests.ToggleRecord());c.disconnect()"
 
The WebSocket password and port can be found in ''WebSocket Server Settings > Show Connect Info''.
 
If you want to avoid complex one-liners, use [https://gitlab.com/AndrewShark/obs-scripts/-/tree/main/obs-wayland-shortcuts recording-toggle.py] script.


== Tips and tricks ==
== Tips and tricks ==
Line 54: Line 75:


* {{AUR|obs-studio-git}} compiles with the browser plugin.
* {{AUR|obs-studio-git}} compiles with the browser plugin.
* {{AUR|obs-linuxbrowser}} (or {{AUR|obs-linuxbrowser-bin}} for pre-compiled binary) provides the old [https://github.com/bazukas/obs-linuxbrowser linuxbrowser] plugin. Works with the default client, but is abandoned and slightly outdated. The quickest way to get the plugin as of December 2021.
* {{AUR|obs-studio-tytan652}} is a custom client that provides the browser plugin as well as browser docks, along with other general improvements.
* {{AUR|obs-studio-tytan652}} is a custom client that provides the browser plugin as well as browser docks, along with other general improvements.


=== Capturing via Vulkan/OpenGL ===
=== Capturing via Vulkan/OpenGL ===


The [https://github.com/nowrep/obs-vkcapture 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]] {{AUR|obs-vkcapture-git}}, as well as {{AUR|lib32-obs-vkcapture-git}} if capturing 32-bit applications. Follow the instructions in the GitHub repository to setup a ''Game Capture'' using the plugin.
The [https://github.com/nowrep/obs-vkcapture 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]] {{AUR|obs-vkcapture}}, as well as {{AUR|lib32-obs-vkcapture}} if capturing 32-bit applications. Follow the instructions in the GitHub repository to setup a ''Game Capture'' using the plugin.


=== Encoding using GStreamer ===
=== Encoding using GStreamer ===
Line 69: Line 89:


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]] {{AUR|obs-gstreamer}} and change OBS' encoder to ''GStreamer Encoder''. If OBS gives an error regarding encoders you might need to [[install]] the {{Pkg|gstreamer-vaapi}} package.
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]] {{AUR|obs-gstreamer}} and change OBS' encoder to ''GStreamer Encoder''. If OBS gives an error regarding encoders you might need to [[install]] the {{Pkg|gstreamer-vaapi}} package.
=== Encoding using AMF ===
[https://github.com/obsproject/obs-studio/pull/7206 obs-studio-amf] is a patch that ports the ''A''MD ''M''edia ''Fr''amework encoder to Linux, which was previously exclusive to Windows.
To make this work you need to setup [[AMDGPU PRO]], [[install]] {{AUR|obs-studio-amf}} and set the {{ic|VK_DRIVER_FILES}} [[environment variable]]:
$ VK_DRIVER_FILES=/usr/share/vulkan/icd.d/amd_pro_icd64.json:/usr/share/vulkan/icd.d/amd_pro_icd32.json obs
As of OBS version 30.0.0, performance on VAAPI and AMF should be similar. AMF patch does not work since version 30.0.0 and the author has stopped supporting it due to extended VAAPI implementation.


=== Manual plugins installation ===
=== Manual plugins installation ===


You can manually install plugin to the {{ic|~/.config/obs-studio/plugins/}}. The folder structure is the following:
You can manually install plugin to the {{ic|~/.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/bin/64-bit/plugin_name.so
  ~/.config/obs-studio/plugins/plugin_name/data/locale/en-US.ini
  ~/.config/obs-studio/plugins/plugin_name/data/locale/en-US.ini
=== Record rectangular area ===
If you use KDE, you can select rectangular area for the recording using the helper script [https://gitlab.com/AndrewShark/obs-scripts/-/tree/main/obs-rectangle-area-selector obs-rectangle-area-selector].
== Troubleshooting ==
=== QuickSync returns "Error creating a MFX session" ===
This error can occur if the right Intel QuickSync drivers are not installed.
[AVHWDeviceContext @ 0x6111a37c1040] Error creating a MFX session: -9.
Device creation failed: -1313558101.
To use QuickSync, install {{Pkg|intel-media-sdk}} for Iron Lake (Gen5) to [[Wikipedia:Ice Lake (microprocessor)|Ice Lake (Gen10)]]  GPUs, or {{Pkg|onevpl-intel-gpu}}{{Broken package link|replaced by {{Pkg|vpl-gpu-rt}}}} for [[Wikipedia:Tiger Lake|Tiger Lake (Gen11)]] and newer GPUs.
For more information, refer to [[FFmpeg#Intel QuickSync (QSV)]].


== See also ==
== See also ==

Latest revision as of 10:41, 4 May 2024

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

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

Reason: Use Template:App to explain what each package does differently. (Discuss in Talk:Open Broadcaster Software)

Install one of the following packages:

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. OBS has upgraded from Qt 5 to Qt 6 since version 28, so installation of qt6-wayland is required for the newer versions. 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 (for example, obs-studio-gitAUR).

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:

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

Reason: Avoid complex one-liners. (Discuss in Talk:Open Broadcaster Software)
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.

If you want to avoid complex one-liners, use recording-toggle.py script.

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-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-vkcaptureAUR, as well as lib32-obs-vkcaptureAUR 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-gstreamerAUR 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-amfAUR and set the VK_DRIVER_FILES environment variable:

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

As of OBS version 30.0.0, performance on VAAPI and AMF should be similar. AMF patch does not work since version 30.0.0 and the author has stopped supporting it due to extended VAAPI implementation.

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

Record rectangular area

If you use KDE, you can select rectangular area for the recording using the helper script obs-rectangle-area-selector.

Troubleshooting

QuickSync returns "Error creating a MFX session"

This error can occur if the right Intel QuickSync drivers are not installed.

[AVHWDeviceContext @ 0x6111a37c1040] Error creating a MFX session: -9.
Device creation failed: -1313558101.

To use QuickSync, install intel-media-sdk for Iron Lake (Gen5) to Ice Lake (Gen10) GPUs, or onevpl-intel-gpu[broken link: replaced by vpl-gpu-rt] for Tiger Lake (Gen11) and newer GPUs.

For more information, refer to FFmpeg#Intel QuickSync (QSV).

See also