1 Commits

Author SHA1 Message Date
3d7efde9e9 Update README.md 2026-07-20 12:00:56 +05:00
2 changed files with 79 additions and 68 deletions

View File

@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.20) 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) include(GNUInstallDirs)
find_package(PkgConfig REQUIRED) find_package(PkgConfig REQUIRED)

145
README.md
View File

@@ -1,55 +1,62 @@
# OBS WebKit Browser Source (без CEF) # OBS WebKit Browser Source (No CEF)
Нативный input source для OBS Studio на Alpine Linux. Страницы рендерит системный A native browser input source for OBS Studio on Alpine Linux. Pages are rendered
WebKitGTK 4.1 в отдельном процессе; Chromium/CEF и Xvfb в проекте нет. Renderer by the system WebKitGTK 4.1 in a separate process; the project does not use
использует X11/XWayland-сессию OBS и держит WebView в полностью прозрачном Chromium/CEF or Xvfb. The renderer uses the X11/XWayland display inherited from
неинтерактивном нативном окне. Нативная surface нужна WebKitGTK для импорта GPU OBS and keeps its WebView in a fully transparent, non-interactive native window.
DMA-BUF. Кадры передаются в OBS напрямую как BGRA, без FFmpeg и захвата рабочего 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-файлы; - HTTP/HTTPS and `data:` URLs, plus local HTML files;
- прозрачный фон с alpha-каналом; - transparent backgrounds with an alpha channel;
- пользовательский CSS; - custom CSS;
- масштаб страницы 25500% с сохранением в настройках источника или web-панели; - 25500% page zoom saved in source or web panel settings;
- опциональный захват звука каждого browser source в отдельную полосу Audio Mixer OBS; - optional per-source audio capture as a separate OBS Audio Mixer channel;
- размер 28192 px и 160 FPS; - dimensions from 2 to 8192 px and frame rates from 1 to 60 FPS;
- аппаратный WebKit compositor через DRM/DMA-BUF (Mesa `radeonsi` на AMD); - hardware-accelerated WebKit compositing through DRM/DMA-BUF (Mesa `radeonsi`
- прямой XComposite/XShm-захват скомпозированного GPU-кадра с alpha; on AMD);
- XDamage-пропуск чтения backing pixmap, пока содержимое страницы не меняется; - direct XComposite/XShm capture of composited GPU frames with alpha;
- shared-memory транспорт кадров без многомегабайтной записи в pipe; - XDamage-based skipping of backing pixmap reads while page content is unchanged;
- мышь, прокрутка, фокус и базовый ввод с клавиатуры через окно Interact OBS; - shared-memory frame transport without sending multi-megabyte frames through a pipe;
- перезагрузка страницы и остановка renderer-процесса у скрытого source. - mouse, scrolling, focus, and basic keyboard input through the OBS Interact window;
- пользовательские web-панели в меню «Док-панели» OBS с сохранением URL в - 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,
- единый постоянный WebKit-профиль для источников на сцене и web-панелей: общие restored on startup, and full interactive input;
cookies, HTTP cache, localStorage, IndexedDB, service workers и credentials; - one shared persistent WebKit profile for scene sources and web panels, including
страницы одного origin взаимодействуют штатными `storage`-событиями и cookies, HTTP cache, localStorage, IndexedDB, service workers, and credentials;
`BroadcastChannel`, как вкладки одного браузера. same-origin pages communicate through standard `storage` events and
`BroadcastChannel`, just like browser tabs.
Захват звука по умолчанию выключен. Включите «Захватывать звук браузера» в Audio capture is disabled by default. Enable **Capture browser audio** in the
настройках нужного источника; его громкость появится отдельной полосой в Audio Mixer OBS. source settings to add its audio as a separate OBS Audio Mixer channel. Capture
Для захвата требуется работающий PulseAudio-совместимый сервер (в том числе requires a running PulseAudio-compatible server (including PipeWire Pulse) and
PipeWire Pulse) и GStreamer `pulsesink`; скрипт установки зависимостей добавляет the GStreamer `pulsesink`; the dependency installation script installs the
необходимый пакет `gst-plugins-good`. required `gst-plugins-good` package.
Все 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-слоям.
Это рабочий backend, а не замена всех расширенных возможностей штатного obs-browser All WebViews in one OBS session share a renderer process and a single
(DevTools, cookies API и DRM здесь пока отсутствуют). `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 ```sh
chmod +x scripts/install-deps-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 doas /usr/bin/cmake --install build --prefix /usr
``` ```
После установки перезапустите OBS и добавьте источник **Браузер WebKit**. After installation, restart OBS and add a **WebKit Browser** source. To add a
Для панели откройте **Док-панели → Пользовательские web-панели...**, добавьте panel, open **Docks → Custom Web Panels...**, enter its name and URL, and click
название и URL и нажмите **Применить**. Панель можно скрывать и показывать через **Apply**. Panels can be shown or hidden through the regular Docks menu; right-click
обычное меню доков OBS; правый клик по странице открывает команду перезагрузки. a page to reload it. If OBS uses a non-standard prefix, set `OBS_PLUGIN_DIR` and
Если OBS установлен в нестандартный prefix, задайте при конфигурации `OBS_PLUGIN_DATA_DIR` during configuration.
`OBS_PLUGIN_DIR` и `OBS_PLUGIN_DATA_DIR`.
## Архив для публикации ## Release Archive
После установки зависимостей используйте отдельные цели `Makefile`: After installing the dependencies, use the dedicated `Makefile` targets:
```sh ```sh
make build make build
@@ -78,14 +84,13 @@ doas make install
make archive make archive
``` ```
`make build` собирает Release-версию, `make test` запускает тесты, `make build` creates a Release build, `make test` runs the tests,
`doas make install` устанавливает плагин в `/usr`, а `make archive` запускает `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` и файл с его `obs-webkit-browser-<version>-linux-<arch>.tar.gz` and its SHA-256 file are written
SHA-256 будут записаны в каталог `dist/`. Внутри нет абсолютных путей: архив 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
`obs-webkit-browser/{bin/64bit,data}`. Установить её можно напрямую в каталог directory:
пользовательских плагинов OBS:
```sh ```sh
mkdir -p ~/.config/obs-studio/plugins 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 -C ~/.config/obs-studio/plugins
``` ```
## Почему WebKitGTK, а не WPE ## Why WebKitGTK Instead of WPE?
WPE архитектурно подходит лучше всего, но пакет `wpewebkit` отсутствует в актуальном WPE would be the best architectural fit, but the `wpewebkit` package is not
Alpine edge/3.24 (остались только `libwpe` и backend). WebKitGTK 4.1 есть в текущем available in current Alpine edge/3.24; only `libwpe` and the backend remain.
репозитории Alpine, использует тот же WebKit и не зависит от CEF. Renderer изолирован WebKitGTK 4.1 is available in the current Alpine repository, uses the same WebKit,
от OBS, поэтому падение Web-процесса не должно уронить студию. 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`