From d22ce0ba5aebfff5ffaea97982472f876af5da22 Mon Sep 17 00:00:00 2001 From: Christophe Besson Date: Fri, 18 Sep 2026 14:37:08 +0200 Subject: feat: decode and re-encode video on the GPU where there is one MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A 1080p film is decoded by whoever watches it and re-encoded by the node when no browser can decode the source. Both were on the CPU, and on an Atom or Celeron mini-PC neither reaches real time — which is what `transcode_incompatible_video` exists to refuse. This adds the mechanism that makes refusing it unnecessary. Node — `hwaccel.py`: VA-API on Linux, Quick Sync or NVENC on Windows, established by encoding 1080p and reading the file back with ffprobe. Nothing is accepted that does not produce the exact profile and level `stream_init` announces, since the client checks that string before it trusts a byte: an encoder that wrote another level would make the node's own codec string a lie, and ffmpeg takes `-level 4.1` and `-level 41` from h264_qsv without saying which it understood. Three modes per stream — hardware decode and encode, hardware encode alone, libx264 — demoted per source codec, because a GPU that decodes HEVC may have no decoder for MPEG-4 Part 2 and only asking it finds out. A mode that fails is detected on an empty stdout before `stream_init` goes out, so the viewer sees one working stream and never an error. Client — Chromium ships VA-API off on Linux. It is enabled where a render node and a driver are present, then verified through `navigator.mediaCapabilities`: a no moves to the next GL backend on the next launch and an exhausted list drops the switches, so a renamed feature cannot pass for a feature that is on and `--ignore-gpu-blocklist` cannot survive on a machine it did not help. Feature lists now merge rather than overwrite — `appendSwitch` replaces the value, and a second caller would have silently cancelled the mDNS switch aiortc depends on. Packaging — the drivers are weak dependencies on all four formats, so a machine without a GPU installs exactly as before. `dpkg -i` and `rpm -ivh` ignore weak deps; `packaging/README.md` now says so. Windows needs no driver: the bundled ffmpeg already carries h264_qsv and h264_nvenc, and a re-pin that dropped them would cost every low-power Windows node its hardware encoding silently. AMD on Windows (AMF) and macOS (VideoToolbox) are named gaps, not oversights: neither could be tried anywhere in this project, and both re-encode in software as before. Co-Authored-By: Claude Opus 5 --- packaging/deb/meshbay-client/DEBIAN/control | 3 ++- packaging/deb/meshbay-node/DEBIAN/control | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'packaging/deb') diff --git a/packaging/deb/meshbay-client/DEBIAN/control b/packaging/deb/meshbay-client/DEBIAN/control index aeb5865..17711c8 100644 --- a/packaging/deb/meshbay-client/DEBIAN/control +++ b/packaging/deb/meshbay-client/DEBIAN/control @@ -7,7 +7,8 @@ Maintainer: MeshBay Team Homepage: https://meshbay.org Depends: libgtk-3-0, libnotify4, libnss3, libxss1, libxtst6, libatspi2.0-0, libdrm2, libgbm1, libasound2 -Recommends: meshbay-node +Recommends: meshbay-node, va-driver-all +Suggests: vainfo Description: MeshBay — peer-to-peer file sharing, streaming and group chat Desktop client for MeshBay. Connects to MeshBay nodes over WebRTC for file sharing, video streaming, and group chat. Includes Chromecast and diff --git a/packaging/deb/meshbay-node/DEBIAN/control b/packaging/deb/meshbay-node/DEBIAN/control index 3eda3fa..eb19eb7 100644 --- a/packaging/deb/meshbay-node/DEBIAN/control +++ b/packaging/deb/meshbay-node/DEBIAN/control @@ -6,7 +6,7 @@ Architecture: all Maintainer: MeshBay Team Homepage: https://meshbay.org Depends: meshbay-common (= __VERSION__) -Recommends: ffmpeg +Recommends: ffmpeg, va-driver-all Description: MeshBay Node — local file host, streaming server, and group daemon MeshBay Node indexes local directories and serves encrypted files to authenticated group members over WebRTC. Includes video streaming (fMP4 @@ -15,4 +15,6 @@ Description: MeshBay Node — local file host, streaming server, and group daemo . Installs node code into the shared venv at /opt/meshbay-common/venv/. Ships a default TMDB API token for the Videos app. - Runs as a systemd user service. + Runs as a systemd user service. Re-encodes video on the GPU where one + works (VA-API), which is what makes streaming an HEVC film from a + low-power machine possible at all. -- cgit v1.2.3