From 85fea4815943a968e31f3bff8718b5062519c1b8 Mon Sep 17 00:00:00 2001 From: catShark <1716967236@qq.com> Date: Sun, 18 Oct 2026 01:09:00 +0800 Subject: [PATCH] docs: document the decoder-driven canPlayType override (0.3.0.0) README gains 1.3 and the 2.0 capability row is corrected: the old "8K HEVC decodingInfo supported:true" was only ever true for 8-bit Main. HANDOFF 18.7/18.8 record what the override does, the three verified modes, the kill switch, and what is deliberately left out (AV1, and acting on smooth:false). --- HANDOFF.md | 29 +++++++++++++++++++++++++---- README.md | 41 ++++++++++++++++++++++++++++++++++++++++- 2 files changed, 65 insertions(+), 5 deletions(-) diff --git a/HANDOFF.md b/HANDOFF.md index a638d93..b638761 100644 --- a/HANDOFF.md +++ b/HANDOFF.md @@ -122,7 +122,7 @@ Style: RightEye, Alignment=8, MarginL=1920, MarginR=50 , MarginV=700 | `XRWebGLBinding.createQuadLayer` | **true** | | `XRWebGLBinding.getSubImage` | **需要 2 个参数** `(layer, frame)` | | `MAX_TEXTURE_SIZE` / `MAX_RENDERBUFFER_SIZE` | **8192 / 16384** | -| 8K HEVC `decodingInfo` | `supported:true, powerEfficient:true` | +| 8K HEVC `decodingInfo` | `supported:true, powerEfficient:true`(仅 8-bit Main,见 ADDENDUM 12) | | `supportedFrameRates` | **[72, 80, 90, 120]** | | `enabledFeatures` | `[local, viewer, bounded-floor, layers, hand-tracking, webxr, local-floor]` | | 手部追踪 | ✅ 25 关节齐全,profiles `["oculus-hand","generic-hand","generic-hand-select","generic-trigger"]` | @@ -890,7 +890,28 @@ enableautobitratebitrate-Video- = false ← 上游拼写,bitra 1. **续播点 33:22.759 的来历**:就是 2026-10-05 那次转码会话留下的(`stopped ... at 2002759ms`)。所以 10-17 两次播放都从 33:22 续播,画面出不来进度自然不动,于是「停在 33:22」重复了两次。 2. **文件本身没问题**:完全分配无空洞(`du` 实际用量 == 表观大小)、`moov` 在文件头(faststart 正常)、33:22 处 ffmpeg 解码无报错、Jellyfin 数据库里时长正确(50:58)。同目录还有 3 个垃圾广告文件(`.url` × 3 + 一个 20 MB 的 `三 上 悠 亚…mp4`),是盗版站打包进来的。 -### 18.7 待办 +### 18.7 已做(插件 0.3.0.0 / bundle `4e9a8f`) -- [ ] `src/00-core.js` 的能力探测补上 Main 10(`hev1.2.4.L183.B0` / `hvc1.2.4.L183.B0`)和 8K/4K 的分档,让诊断面板不再只说「8K HEVC 支持」 -- [ ] 若想彻底自动化(PC 自动转码、Quest 继续直连 8K):用 `MediaCapabilities.decodingInfo` 真机探测后覆盖 `HTMLVideoElement.prototype.canPlayType`,让 Jellyfin Web 自己那套 `maxHevcLevel` 逻辑算出准确 profile(Meta 官方文档也是这么建议的)。看门狗是「先给用户一个出路」的版本,不是这个。 +- [x] `src/00-core.js` 的能力探测补上 Main 10 和 8K/4K 分档;新增 `NS.caps.codec`(`decodingInfo` 逐档结果)与 `NS.capsDiag()` 里的 `HEVC real` 段 +- [x] **彻底自动化**:用 `MediaCapabilities.decodingInfo` 真机探测后覆盖 `HTMLVideoElement.prototype.canPlayType`,让 Jellyfin Web 自己那套 `maxHevcLevel` 逻辑算出准确 profile + +覆盖逻辑的关键点: + +- 每档在**它对应的分辨率**上探测(level 字符串不带尺寸):`L120→1920x1080@30`、`L123→1080p60`、`L153→3840x2160@60`、`L183/L186→8192x4096@60` +- codec string → `':'`(`hvc1.2.4.L183` → `2:183`);`hvc1`/`hev1` 同键,因为差的只是 sample entry +- **只有 `supported === false` 才降级**;`supported:true, smooth:false` 只记录不行动(太贴边,而且看门狗已经兜底) +- 钩子在 bundle 执行时**同步**装上(此时还没有 verdict,一律交给原生),探测结果落地后才生效 +- 逃生开关:`localStorage['jfvr-cpt'] = 'off'` → 完全不装钩子 + +三种模式本地实测(`_harness-codec.html`,全过): + +| 模式 | 结果 | +|---|---| +| `pc` | 8K Main10 被拦 → Jellyfin 封顶 level 153 → 8K 文件超出声明 → **转码** | +| `quest` | 无一被拦 → 声明保持 ≥183 → **Direct Play 不变** | +| `off` | 钩子未安装,`canPlayType` 完全未动 → 恢复旧行为 | + +### 18.8 待办 + +- [ ] 探测目前只覆盖 HEVC。AV1 / VP9 走同一套机制,但库里没有这类片源,先不做。 +- [ ] `decodingInfo` 的 `smooth` 现在是只记录不行动。如果哪天出现「supported:true 但实际掉帧」的案例,可以考虑把 `smooth === false` 也纳入降级条件(风险:可能误伤 Quest)。 diff --git a/README.md b/README.md index 1792799..0ae677f 100644 --- a/README.md +++ b/README.md @@ -93,6 +93,41 @@ enableautobitratebitrate-Video- = false 选过之后 120 秒内不再打扰(记在 sessionStorage)。 +### 1.3 让客户端如实上报解码能力(`canPlayType` 覆盖) + +`src/00-core.js`。解决的问题:**Jellyfin 的直连/转码决策 100% 看客户端上报的设备档案**,而 Jellyfin Web 是从 `canPlayType` 推出整个 HEVC 声明的(`browserDeviceProfile.js`): + +```js +if (canPlayType('video/mp4; codecs="hvc1.2.4.L183"')) { + maxHevcLevel = 183; // level 6.1 = 8K + hevcProfiles = 'main|main 10'; +} +``` + +`canPlayType` 回答的是「这台机器*有没有* HEVC 解码器」,不是「能不能解 8192×4096 的 Main 10 @60fps」。所以一个只是「系统里有 HEVC 解码器」的桌面浏览器会声称支持 8K Main 10 → 服务器选 DirectPlay → 黑屏(而 OSD 压根不会创建,见 §1.2)。 + +插件的做法: + +1. 页面加载时用 **`MediaCapabilities.decodingInfo`** 对 HEVC 各档做真机探测(每档在它对应的分辨率上测:L120→1080p30、L153→4K60、L183/L186→8K60,因为 level 字符串本身不带尺寸); +2. 把结果回灌给 `HTMLVideoElement.prototype.canPlayType`:只有 `supported === false` 才返回 `''`,其余全部交给原生实现。 + +这样 Jellyfin Web 自己那套 `maxHevcLevel` 逻辑就会得出**准确**档案: + +| 设备 | 结果 | +|---|---| +| 桌面(声称支持但实际解不动 8K Main 10) | 降到 level 153 → 8K 文件超出声明 → **服务器转码** | +| Quest 3(真能解 8K Main 10) | 保持 ≥183 → **继续 Direct Play** | + +**故意保守**:只有 `supported === false` 才降级。`supported:true, smooth:false` 会记录但不影响行为 —— 太贴边了,而且「声称能播结果没播出来」已经有 §1.2 的看门狗兜底。 + +出问题的逃生开关(某台设备报得离谱时用): + +```js +localStorage['jfvr-cpt'] = 'off'; // 然后刷新,覆盖完全不安装 +``` + +当前状态可以在诊断面板里看到(`canPlayType hook` 和 `HEVC real (decodingInfo)` 两段)。这也是 Meta 官方文档推荐的做法 —— 他们明确说「用 Media Capabilities API 探测,不要靠 UA 嗅探」。 + --- ## 2. Quest 3 实测数据(已用 ADB + CDP 在真机验证) @@ -114,10 +149,14 @@ UA Mozilla/5.0 (X11; Linux x86_64; Quest 3) ... Chrome/152 ... VR Safari/537.36 | `XRWebGLBinding` | — | true ← 回退路径可用 | | `MAX_TEXTURE_SIZE` | 8192 | 8192 | | `MAX_RENDERBUFFER_SIZE` | 16384 | 16384 | -| 8K HEVC `decodingInfo` | supported / powerEfficient | **supported:true, powerEfficient:true** | +| 8K HEVC `decodingInfo` | supported / powerEfficient | **supported:true, powerEfficient:true**(仅 8-bit Main) | 结论:**HTTPS 下 Quest 浏览器提供全部所需 WebXR 能力,8K HEVC 走硬件解码。** +> ⚠️ 上面那行 `decodingInfo` 当年只测了 **8-bit Main** 的 codec string(`hev1.1.6.L183.B0`), +> **10-bit Main 10(`hev1.2.4.L183.B0`)从来没测过**。插件现在会分档探测(见 §1.3), +> 诊断面板里会列出 Main/Main10 × 4K/8K 的真实结果。 + ### 2.1 网络实测:HTTPS 域名在 Quest 上就是内网直连 ```