Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3d7efde9e9 |
@@ -1,6 +1,6 @@
|
||||
cmake_minimum_required(VERSION 3.20)
|
||||
|
||||
project(obs-webkit-browser VERSION 1.2.0 LANGUAGES C CXX)
|
||||
project(obs-webkit-browser VERSION 1.2.1 LANGUAGES C CXX)
|
||||
|
||||
include(GNUInstallDirs)
|
||||
find_package(PkgConfig REQUIRED)
|
||||
|
||||
145
README.md
145
README.md
@@ -1,55 +1,62 @@
|
||||
# OBS WebKit Browser Source (без CEF)
|
||||
# OBS WebKit Browser Source (No CEF)
|
||||
|
||||
Нативный input source для OBS Studio на Alpine Linux. Страницы рендерит системный
|
||||
WebKitGTK 4.1 в отдельном процессе; Chromium/CEF и Xvfb в проекте нет. Renderer
|
||||
использует X11/XWayland-сессию OBS и держит WebView в полностью прозрачном
|
||||
неинтерактивном нативном окне. Нативная surface нужна WebKitGTK для импорта GPU
|
||||
DMA-BUF. Кадры передаются в OBS напрямую как BGRA, без FFmpeg и захвата рабочего
|
||||
стола.
|
||||
A native browser input source for OBS Studio on Alpine Linux. Pages are rendered
|
||||
by the system WebKitGTK 4.1 in a separate process; the project does not use
|
||||
Chromium/CEF or Xvfb. The renderer uses the X11/XWayland display inherited from
|
||||
OBS and keeps its WebView in a fully transparent, non-interactive native window.
|
||||
WebKitGTK needs this native surface to import GPU DMA-BUF buffers. Frames are
|
||||
sent directly to OBS as BGRA without FFmpeg or desktop capture.
|
||||
|
||||
Поддерживается:
|
||||
Features:
|
||||
|
||||
- HTTP/HTTPS, `data:` URL и локальные HTML-файлы;
|
||||
- прозрачный фон с alpha-каналом;
|
||||
- пользовательский CSS;
|
||||
- масштаб страницы 25–500% с сохранением в настройках источника или web-панели;
|
||||
- опциональный захват звука каждого browser source в отдельную полосу Audio Mixer OBS;
|
||||
- размер 2–8192 px и 1–60 FPS;
|
||||
- аппаратный WebKit compositor через DRM/DMA-BUF (Mesa `radeonsi` на AMD);
|
||||
- прямой XComposite/XShm-захват скомпозированного GPU-кадра с alpha;
|
||||
- XDamage-пропуск чтения backing pixmap, пока содержимое страницы не меняется;
|
||||
- shared-memory транспорт кадров без многомегабайтной записи в pipe;
|
||||
- мышь, прокрутка, фокус и базовый ввод с клавиатуры через окно Interact OBS;
|
||||
- перезагрузка страницы и остановка renderer-процесса у скрытого source.
|
||||
- пользовательские web-панели в меню «Док-панели» OBS с сохранением URL в
|
||||
коллекции сцен, восстановлением после запуска и интерактивным вводом.
|
||||
- единый постоянный WebKit-профиль для источников на сцене и web-панелей: общие
|
||||
cookies, HTTP cache, localStorage, IndexedDB, service workers и credentials;
|
||||
страницы одного origin взаимодействуют штатными `storage`-событиями и
|
||||
`BroadcastChannel`, как вкладки одного браузера.
|
||||
- HTTP/HTTPS and `data:` URLs, plus local HTML files;
|
||||
- transparent backgrounds with an alpha channel;
|
||||
- custom CSS;
|
||||
- 25–500% page zoom saved in source or web panel settings;
|
||||
- optional per-source audio capture as a separate OBS Audio Mixer channel;
|
||||
- dimensions from 2 to 8192 px and frame rates from 1 to 60 FPS;
|
||||
- hardware-accelerated WebKit compositing through DRM/DMA-BUF (Mesa `radeonsi`
|
||||
on AMD);
|
||||
- direct XComposite/XShm capture of composited GPU frames with alpha;
|
||||
- XDamage-based skipping of backing pixmap reads while page content is unchanged;
|
||||
- shared-memory frame transport without sending multi-megabyte frames through a pipe;
|
||||
- mouse, scrolling, focus, and basic keyboard input through the OBS Interact window;
|
||||
- page reload and optional renderer shutdown while a source is hidden;
|
||||
- custom web panels in the OBS Docks menu, with URLs stored in the scene collection,
|
||||
restored on startup, and full interactive input;
|
||||
- one shared persistent WebKit profile for scene sources and web panels, including
|
||||
cookies, HTTP cache, localStorage, IndexedDB, service workers, and credentials;
|
||||
same-origin pages communicate through standard `storage` events and
|
||||
`BroadcastChannel`, just like browser tabs.
|
||||
|
||||
Захват звука по умолчанию выключен. Включите «Захватывать звук браузера» в
|
||||
настройках нужного источника; его громкость появится отдельной полосой в Audio Mixer OBS.
|
||||
Для захвата требуется работающий PulseAudio-совместимый сервер (в том числе
|
||||
PipeWire Pulse) и GStreamer `pulsesink`; скрипт установки зависимостей добавляет
|
||||
необходимый пакет `gst-plugins-good`.
|
||||
Все WebView одной сессии OBS работают в общем renderer-процессе и одном
|
||||
`WebKitWebContext`; маленькие процессы-посредники сохраняют прежнюю независимую
|
||||
жизнь каждого source/dock и изоляцию от OBS. Профиль хранится в стандартных каталогах
|
||||
данных и cache пользователя (`obs-webkit-browser/profile`) и переживает перезапуск OBS.
|
||||
Renderer наследует X11/XWayland-дисплей OBS; его нативное окно имеет нулевую opacity,
|
||||
пустую input shape и не появляется на рабочем столе. Дополнительный display server не
|
||||
запускается. WebKit принудительно включает аппаратный compositor и выбирает доступный
|
||||
DRM render node; для него нужен доступ к `/dev/dri/renderD*`.
|
||||
Для тяжёлого полноэкранного `filter: blur()` всё ещё разумно выбирать реальный размер
|
||||
виджета вместо рендера 4K/1080p с последующим уменьшением в сцене. Пользовательские
|
||||
`will-change` и compositor hints сохраняются, но renderer не внедряет их в страницу сам:
|
||||
WebKit сам распределяет элементы по GPU-слоям.
|
||||
Audio capture is disabled by default. Enable **Capture browser audio** in the
|
||||
source settings to add its audio as a separate OBS Audio Mixer channel. Capture
|
||||
requires a running PulseAudio-compatible server (including PipeWire Pulse) and
|
||||
the GStreamer `pulsesink`; the dependency installation script installs the
|
||||
required `gst-plugins-good` package.
|
||||
|
||||
Это рабочий backend, а не замена всех расширенных возможностей штатного obs-browser
|
||||
(DevTools, cookies API и DRM здесь пока отсутствуют).
|
||||
All WebViews in one OBS session share a renderer process and a single
|
||||
`WebKitWebContext`. Small proxy processes preserve the independent lifetime of
|
||||
each source or dock and isolate them from OBS. The profile is stored in the
|
||||
standard user data and cache directories under `obs-webkit-browser/profile` and
|
||||
survives OBS restarts.
|
||||
|
||||
## Сборка на Alpine
|
||||
The renderer inherits the X11/XWayland display from OBS. Its native window has
|
||||
zero opacity and an empty input shape, so it does not appear on the desktop. No
|
||||
additional display server is started. WebKit is forced to use its hardware
|
||||
compositor and selects an available DRM render node, which requires access to
|
||||
`/dev/dri/renderD*`.
|
||||
|
||||
For expensive full-screen `filter: blur()` effects, use the actual widget size
|
||||
instead of rendering at 4K/1080p and scaling the source down in the scene. Custom
|
||||
`will-change` declarations and compositor hints are preserved, but the renderer
|
||||
does not inject them itself; WebKit assigns elements to GPU layers.
|
||||
|
||||
This is a working backend, not a replacement for every advanced feature in the
|
||||
standard obs-browser plugin. DevTools, the cookies API, and DRM are not currently
|
||||
available.
|
||||
|
||||
## Building on Alpine
|
||||
|
||||
```sh
|
||||
chmod +x scripts/install-deps-alpine.sh
|
||||
@@ -60,16 +67,15 @@ ctest --test-dir build --output-on-failure
|
||||
doas /usr/bin/cmake --install build --prefix /usr
|
||||
```
|
||||
|
||||
После установки перезапустите OBS и добавьте источник **Браузер WebKit**.
|
||||
Для панели откройте **Док-панели → Пользовательские web-панели...**, добавьте
|
||||
название и URL и нажмите **Применить**. Панель можно скрывать и показывать через
|
||||
обычное меню доков OBS; правый клик по странице открывает команду перезагрузки.
|
||||
Если OBS установлен в нестандартный prefix, задайте при конфигурации
|
||||
`OBS_PLUGIN_DIR` и `OBS_PLUGIN_DATA_DIR`.
|
||||
After installation, restart OBS and add a **WebKit Browser** source. To add a
|
||||
panel, open **Docks → Custom Web Panels...**, enter its name and URL, and click
|
||||
**Apply**. Panels can be shown or hidden through the regular Docks menu; right-click
|
||||
a page to reload it. If OBS uses a non-standard prefix, set `OBS_PLUGIN_DIR` and
|
||||
`OBS_PLUGIN_DATA_DIR` during configuration.
|
||||
|
||||
## Архив для публикации
|
||||
## Release Archive
|
||||
|
||||
После установки зависимостей используйте отдельные цели `Makefile`:
|
||||
After installing the dependencies, use the dedicated `Makefile` targets:
|
||||
|
||||
```sh
|
||||
make build
|
||||
@@ -78,14 +84,13 @@ doas make install
|
||||
make archive
|
||||
```
|
||||
|
||||
`make build` собирает Release-версию, `make test` запускает тесты,
|
||||
`doas make install` устанавливает плагин в `/usr`, а `make archive` запускает
|
||||
сборку и тесты, после чего создаёт пакет без установки файлов в систему.
|
||||
Готовый архив `obs-webkit-browser-<version>-linux-<arch>.tar.gz` и файл с его
|
||||
SHA-256 будут записаны в каталог `dist/`. Внутри нет абсолютных путей: архив
|
||||
содержит только пользовательскую структуру плагина
|
||||
`obs-webkit-browser/{bin/64bit,data}`. Установить её можно напрямую в каталог
|
||||
пользовательских плагинов OBS:
|
||||
`make build` creates a Release build, `make test` runs the tests,
|
||||
`doas make install` installs the plugin into `/usr`, and `make archive` builds and
|
||||
tests the project before creating a package without installing it. The archive
|
||||
`obs-webkit-browser-<version>-linux-<arch>.tar.gz` and its SHA-256 file are written
|
||||
to `dist/`. The archive contains no absolute paths, only the user plugin layout
|
||||
`obs-webkit-browser/{bin/64bit,data}`. Install it directly into the OBS user plugin
|
||||
directory:
|
||||
|
||||
```sh
|
||||
mkdir -p ~/.config/obs-studio/plugins
|
||||
@@ -93,9 +98,15 @@ tar -xzf dist/obs-webkit-browser-<version>-linux-<arch>.tar.gz \
|
||||
-C ~/.config/obs-studio/plugins
|
||||
```
|
||||
|
||||
## Почему WebKitGTK, а не WPE
|
||||
## Why WebKitGTK Instead of WPE?
|
||||
|
||||
WPE архитектурно подходит лучше всего, но пакет `wpewebkit` отсутствует в актуальном
|
||||
Alpine edge/3.24 (остались только `libwpe` и backend). WebKitGTK 4.1 есть в текущем
|
||||
репозитории Alpine, использует тот же WebKit и не зависит от CEF. Renderer изолирован
|
||||
от OBS, поэтому падение Web-процесса не должно уронить студию.
|
||||
WPE would be the best architectural fit, but the `wpewebkit` package is not
|
||||
available in current Alpine edge/3.24; only `libwpe` and the backend remain.
|
||||
WebKitGTK 4.1 is available in the current Alpine repository, uses the same WebKit,
|
||||
and does not depend on CEF. The renderer is isolated from OBS, so a Web process
|
||||
crash should not bring down the studio.
|
||||
|
||||
## Donations
|
||||
|
||||
- TRC20: `TYxUB8Vey9xh7jS9cPU2R34eT97pAN851v`
|
||||
- TON: `UQDBYC5TfbQLsgf50xtBaq9jtyhMl4klwJIeWh6HY_fWim42`
|
||||
|
||||
Reference in New Issue
Block a user