Skip to content

Bring PS5 GTA6 to 120FPS with DLSS 5. An advanced Windows video player and capture enhancement tool featuring real-time preview for videos, images, and capture card sources. Combine AI-powered Super Resolution, DLSS5 image enhancement, and Frame Generation to deliver a next-generation visual experience.

C++

Veyra 2.0.1: export survives a GPU reset, VRAM growth names NVIDIA App's plug-in, Xbox logs the full SDP

Veyra Goal Agent8f42fd514759
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b0e0823b..6ec2d9c8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,9 +1,9 @@
cmake_minimum_required(VERSION 3.24)
-project(veyra VERSION 2.0.0 LANGUAGES CXX RC)
+project(veyra VERSION 2.0.1 LANGUAGES CXX RC)
# Shown in the EXE's version resource and in the package name. CMake versions
# must be numeric, so the beta marker lives here instead.
-set(VEYRA_DISPLAY_VERSION "2.0.0" CACHE STRING "Human-readable version string")
+set(VEYRA_DISPLAY_VERSION "2.0.1" CACHE STRING "Human-readable version string")
# The cache keeps the first value it ever saw, so a release that bumps
# project(VERSION) used to ship an EXE still stamped with the previous display
# string. Re-align it whenever the cached label does not start with the project
diff --git a/docs/RELEASE_2.0.1_2026-10-02.md b/docs/RELEASE_2.0.1_2026-10-02.md
new file mode 100644
index 00000000..4587d275
--- /dev/null
+++ b/docs/RELEASE_2.0.1_2026-10-02.md
@@ -0,0 +1,35 @@
+# 2.0.1(2026-10-02)
+
+用户要求:修 8K 导出失败、再查 Xbox("其他软件能串流上")、看爆显存有没有抓到,修好发 2.0.1;README 不动;Release 正文保留 2.0.0 全部内容并加上这次的修复。2.0.0 当晚的原地更新包内容见 `docs/HOTFIX_2.0.0_2026-10-02.md`,2.0.1 全部包含。
+
+## 现场日志结论
+
+| 日志 | 结论 |
+|---|---|
+| export-worker-8564(RTX 4070 Ti SUPER,8K 7680×3840,NR 原生,SF-v2) | 第 697 帧左右 GPU 挂起,nvlddmkm 153 / 0x887A0006。同机播放日志 qml(10) 在 8K + NR(内部 2560×1280)也挂过一次。和 4070S 的"社区 NR 在 Ada 上随机挂起"同类;1.4.4(另一个社区版)这位用户同一片子在 2091 帧挂。不是导出流程本身的错误 |
+| qml(10) 重置后 | 同进程 `NGX Init_with_ProjectID` 返回 0xBAD00001:设备重置后 NGX 不能在同一进程再起来 |
+| qml(12)(RTX 5060 Ti,采集 4K60) | vram-watch 抓到:只在全屏时涨(约 700 MiB/min,32~128 MiB 一块),退出全屏停止且不回落;重建交换链 0 MiB、重建处理链 −148~−225 MiB;第三方模块里有 `nvppex.dll`(NVIDIA App 画面插件),无 NvPresent64。本机 5070(进程里没有 nvppex)全屏两分钟 0 增长,未能复现 |
+| xbox qml(9)(2.0.0 原包) | SDP 应答解析在 null 字段上抛异常,真实拒绝原因丢失;我们的 offer 与 Greenlight 的传输、方向、通道、编解码顺序一致,会话参数相同。**根因未找到**,需要用 2.0.1 / 更新后的 2.0.0 的日志 |
+
+## 改动
+
+- **导出跨设备重置续导**:`VideoExportJob` 在 GPU 被重置时不再整段失败:不让死设备排空,把已收到的编码包、音频写完并写索引,得到合法的分段文件,报告"从源时间 X 接着导"(取最后写入帧后半帧,不会因舍入多跳或重复一帧);导出进程以退出码 4 结束。`ExportJobManager` 收到后保留分段、沿用同一个任务编号重新启动导出进程(最多 3 次续导、4 段);最后一个进程完成自己那段后用 `joinExportSegments` 逐包复制拼接(按各段首帧源时间平移时间戳,丢弃接缝处不前进的包,要求轨道与视频参数集一致,否则保留各段并说明),成功后删除分段。取消会删除全部分段。共享内存版本 6→7。测试钩子 `VEYRA_TEST_EXPORT_REMOVE_DEVICE_AT=<帧>`(只在第一段进程生效,调用 `ID3D12Device5::RemoveDevice`)。
+- **爆显存**:检测到 `nvppex.dll` / `NvPresent64.dll` 时,看门狗不再做重建(现场证明释放不了、还会闪屏),提示到 NVIDIA App 为 Veyra 关闭 RTX HDR / 智能平滑运动 / 动态鲜艳度;`overlay-hooks` 记录 nvppex 何时注入。
+- **Xbox**:日志写出完整 offer / answer SDP(offer 不含候选地址),配合更新包里已修的空字段处理,下一份日志能看到主机的拒绝原因。
+- 版本 2.0.1(数据目录仍为 `user-data-2.0.0`,设置不丢);打包脚本接受 2.0.x,发行说明按版本取,运行库锁沿用 2.0.0(运行库未变)。
+
+## 验证
+
+| 项目 | 结果 |
+|---|---|
+| 续导:12 s 1080p30 带音轨,NR 开,第 120 帧移除设备 | 第一段 116 帧收尾,从 3.850 s 续导,第二段 243 帧;拼接 921 包、0 丢弃;输出 359 帧 = 源帧数,时长 11.967 s,无帧间空洞,完整解码 0 错误,接缝前后画面连续;界面队列显示"成功 1",说明"显卡重置 1 次,已分 2 段导出并无损拼接" |
+| 导出回归(未注入):queue / lifecycle / lifecycle-boundary / mp4 / mkv | 全部 PASS |
+| queue-unit / qml-data / color-chain worker | PASS(qml-easing 所需旧候选目录已在清理时删除,未跑) |
+| 爆显存提示 | 编译通过;本机无 nvppex,**提示路径未实机触发** |
+| Xbox | 编译通过、xbox 单测 72/72;**未实机** |
+
+## 仍待用户
+
+- 8K 导出:请 4070 Ti SUPER 用户用 2.0.1 重导;挂起仍会发生,但应自动续上。若一次导出里挂了 4 次以上会失败并列出已保存的分段。
+- 爆显存:请 5060 Ti 用户在 NVIDIA App 里对 Veyra 关闭 RTX HDR / 智能平滑运动 / 动态鲜艳度再全屏试,确认是否就是它。
+- Xbox:请用 2.0.1 再连一次并发日志(`xbox` 行里会有主机原因和完整 SDP)。
diff --git a/docs/RELEASE_NOTES_2.0.1.md b/docs/RELEASE_NOTES_2.0.1.md
new file mode 100644
index 00000000..755ac8da
--- /dev/null
+++ b/docs/RELEASE_NOTES_2.0.1.md
@@ -0,0 +1,158 @@
+# Veyra 2.0.1
+
+2.0.0 发布后的修复版。**2.0.0 的完整更新内容保留在下方**,从 1.4.4 升级的用户请一起看。设置与 2.0.0 共用,覆盖解压或换新文件夹都可以。English follows the Chinese section.
+
+## 中文
+
+### 2.0.1 修复
+
+- **导出时显卡被系统重置,不再整段作废**:8K、长视频开 NR 导出时,40 系显卡偶发驱动卡死并被 Windows 重置(社区版 NR 运行库在 Ada 上的已知问题)。现在已导出的部分会自动保存,新开一个导出进程从断点接着导,最后无损拼接成一个文件,不重新编码;最多续 3 次。注意:这让导出能扛过重置,重置本身仍会发生,画面会在重置那一刻停一下。
+- **全屏时显存一直涨**:现场日志显示,只在全屏时涨、退出全屏就停,Veyra 重建显示链和处理链都释放不了;同时进程里都有 NVIDIA App 的画面插件(RTX HDR / 智能平滑运动 / RTX 动态鲜艳度)。现在检测到它时会直接提示到 NVIDIA App → 图形 → 程序设置里为 Veyra 关闭这几项,不再做无效的重建(之前每次都会让画面闪一下)。
+- **Xbox 串流连不上时看不到原因**:主机回复里的空字段让程序先报错,把主机给出的拒绝原因盖住了。现在会显示主机的原因,并在日志里记录完整的连接协商内容,方便对照能连上的客户端排查。
+- 以下几项已在 2.0.0 的更新包里修过,2.0.1 一并包含:
+ - 输出稳定器·抗闪烁打开再关闭后画面定住;
+ - 首页"继续上次"的采集卡没有声音;
+ - 多层 NR 时性能球只算一层;
+ - 调色"效果"组的纹理 / 清晰度 / 去朦胧没有效果;
+ - 点击任务栏图标不能最小化;
+ - 采集开始时显卡设备丢失或崩溃,且检测到 NVIDIA App 画面插件或 RTSS 注入时,提示去哪里关闭。
+
+对应源码:`Veyra-2.0.1-source.zip`;第三方依赖源码与 2.0.0 相同,`Veyra-2.0.0-dependency-source.zip` 随本 Release 一起提供。运行库没有变化。
+
+## English
+
+### 2.0.1 fixes
+
+- **An export survives a GPU reset**: 8K and long exports with NR occasionally hung the driver on RTX 40 cards and Windows reset the GPU (a known issue of the community NR runtimes on Ada), losing the whole file. The part already exported is now kept, a fresh export process continues from that point, and the parts are joined into one file without re-encoding (up to three resets). The reset itself still happens; this makes the export survive it.
+- **Video memory kept growing in fullscreen**: field logs grew only in fullscreen, stopped when leaving it, and neither a swapchain nor a pipeline rebuild released any of it, always with NVIDIA App's picture plug-in (RTX HDR / Smooth Motion / RTX Dynamic Vibrance) loaded. Veyra now names it and points to NVIDIA App → Graphics → Program Settings, instead of rebuilding in vain (each rebuild flashed the picture).
+- **Xbox connection failures hid the reason**: a null field in the console's reply raised an error first. The console's reason is now shown, and the whole negotiation is logged for comparison with a client that connects.
+- Already in the refreshed 2.0.0 package and included here: the picture froze after turning the output stabiliser (anti-flicker) on and off; "Continue" on a capture card had no sound; the load gauge counted one of several NR layers; colour Texture / Clarity / Dehaze had no effect; clicking the taskbar button did not minimise; when the GPU device is lost or Veyra crashes as a capture starts with NVIDIA App's plug-in or RTSS injected, Veyra says where to turn them off.
+
+Corresponding source: `Veyra-2.0.1-source.zip`; third-party dependency sources are unchanged from 2.0.0 and `Veyra-2.0.0-dependency-source.zip` is attached to this Release too. Runtimes are unchanged.
+
+---
+
+# Veyra 2.0.0
+
+从 1.4.4 升级:全新 QML 界面、节点处理、多层 NR、PC/Xbox 串流与新的导出工作流。以下按“新增与改进 → 修复 → 已知边界”排列。English follows the Chinese section.
+
+## 中文
+
+### 新功能与重要改进
+
+**1. 全新界面与操作**
+
+- 新首页、最近使用/继续上次、极简观影、专业列表、节点画布、独立调色、导出和设置页;统一暗色外观、图标、字体、菜单、确认框、滚动条与动效。
+- 全新圆角渐变黑底 Logo,EXE 与 Qt 窗口/任务栏图标统一。README 用新版专业模式截图替换旧动图,并重写操作教程。
+- 简体中文、繁体中文、English、日本語,支持跟随系统;设置包含界面缩放、启动尺寸、快捷键、音频设备和单显卡 GPU 占用监控。
+- 极简悬浮播放条可隐藏;全屏自动隐藏控制、顶部极简/专业切换、Home 快速调节与控制锁定。文件画面点击暂停、双击全屏、左右键跳转。
+- 文件比例/旋转信息、适应/原始/填充、原画/增强分屏、按住 V 对比、强制 SDR 预览、截图、字幕/音轨入口和高级字幕设置接入新界面。
+
+**2. 节点模式与多层增强**
+
+- 新增真实节点处理链:添加、端口拖拽/点击连接、拖到线上插入、拖离断开、右键删除/复制/重置、中键平移、滚轮缩放、适配视图与自动排列。
+- NR 最多四层,每层独立 Feature 实例、内部尺寸与参数;列表总开关支持恢复各层开关状态。调色可多实例,NR/调色可在允许拓扑中穿插于超分前后。
+- 复制节点保留参数并旁置为未连接副本;编辑草稿与最后有效运行链区分,非法/断线状态明确提示,不将可见节点冒充运行节点。
+- 列表/节点参数、会话和预设独立保存;切换恢复各自状态。个人预设支持内容选项、导入/导出、启动默认,取消强加内置预设。
+- 输入后共享光流、单个超分、Video HDR 在补帧前、单个末端补帧;不是任意分支混合图。**节点离线导出延期,2.0.0 只支持列表离线导出。**
+- 列表提供全局 NR 保护区域(含形状参数),排除区域内全部 NR 层并保留非 NR 处理;节点不提供保护区域。
+- 调色补齐曲线、八色混色器、色轮、黑白/校准、组旁路/复位、逐参数复位、LUT 文件导入、颜色预设和原图对比。
+
+**3. 增强后端、补帧与诊断**
+
+- NR 提供 Lecram / SF-v2 社区运行版本选择并全链切换;新配置按显卡分档选择(RTX20/30/40 SF-v2,RTX50 Lecram),保留实验边界。
+- DLSS FG 运行库升级 310.9.1,接入记录来源的 Transfusion 兼容路径;50 系原生路径保留,30/40 系实卡仍待验证。DLSS 倍率按能力提供 2/3/4/6×。
+- XeSS 选项与 SDK 能力对齐,支持适用环境中的 2/3/4×;FSR 3.1 与 FSR 4 ML 分开显示,FSR 为 2×,FSR 4 限 AMD 且需实际匹配 provider,不把回退 3.1 标成 4。
+- 超分增加 5K/6K/7K 尺寸选项与独立运动输入设置;运动估算质量、AMD 半分辨率光流、内容节奏、同步/低队列/输出上限在新版页面可调。
+- 输出稳定器/抗闪烁控制、逐层 NR/节点 GPU 最近一秒平均耗时、帧时间折线、处理预算与排队诊断。软件提交 FPS 不等于物理显示帧数。
+- 崩溃转储、设备移除/DRED 停止点、加载模块、采集驱动帧龄、显存回收诊断与分阶段重建 watchdog;这些诊断不等于已根治 TDR/显存增长。
+
+**4. 更多来源与采集优化**
+
+- PC 串流:Moonlight/Sunshine 协议、发现/手填主机、PIN 配对、应用列表、身份保存、键鼠/手柄输入与统计。主机 Sunshine 自行安装。
+- Xbox:账号设备码登录、主机会话与原生 WebRTC、首页/弹窗入口;非官方实验功能,不保证所有服务/主机环境可用。
+- 串流接入硬件 AV1/HEVC 解码、配对保持与高码率默认配置;PS5、PC、Xbox 共用现有增强链,不另造三套效果器。
+- 美乐威 Pro Capture SDK 低延迟入口;普通采集路径保留。原生格式采集上传减少拷贝,MJPEG 多解码器并行并直接写 NV12;高负载下减少额外排队。
+- 已有特定 KUHAIMI 27P/RTX5070 静态测试中,2K60 NV12 采集回调至 Present 返回约 1.95→0.90 ms,4K30 约 3.2→1.47 ms;**只代表该软件内部区间,不是采集卡固有延迟或屏幕端到端延迟,不外推所有设备。**
+
+**5. 新导出工作流**
+
+- 多文件可编辑顺序队列、每任务独立设置快照、剪辑范围/缩略图、MP4/MKV、码率直接输入、预计体积与单项剩余时间。
+- 多音轨与内嵌字幕保留全部/指定轨道;自动保留时跳过不支持封装的轨道并提示,手选不兼容轨道则明确失败。
+- 暂停、取消、重试、完成提示音;默认 VBR 8 Mbps。默认开始导出即关闭当前播放/采集/串流以释放 GPU,可关闭此选项。
+- 离线导出完整处理源帧;节点模式不导出,FSR/XeSS 实时补帧不等于新增对应离线补帧支持。
+
+**6. OBS 游戏采集兼容**
+
+- 设置 → 通用与外观新增持久化开关(默认关闭),保存后询问“是/否”重启。是正常释放播放器后重新启动,否下次生效;导出时提示等待。
+- 软件绘制 UI 避免 UI 与视频 DXGI 交换链竞争,视频/NR/SR/FG 仍走原 GPU 链;部分界面阴影和模糊简化。
+- 游戏采集针对视频,完整 UI 使用 Windows 10 (1903+) 窗口采集。该开关不是 RTSS/游戏加加适配。
+
+### Bug 修复
+
+- **多层与状态**:修复堆叠 NR 黑帧/仅一层时域执行、层参数复制隔离、列表/节点配置互相污染、预设恢复混用、断线草稿改动污染运行链、非法倍率写入预设、参数复位与滑条外部状态不同步。
+- **补帧与呈现**:FSR 改独立生成纹理,修复同窗口热切换资源生命周期;FSR 4 拒绝后 UI 正确回滚;修复 XeSS 临时字符串迭代器未定义行为和倍率入口;低延迟队列不再误改 NR/SR 顺序;垂直同步保持低深度排队。对比模式明确显示“补帧暂停”,避免误报无效。
+- **窗口与 UI**:修复切屏/DPI 崩溃、视频覆盖控制条/菜单/提示、极简黑边与播放条裁剪、拖进度误拖窗口、空页面无法选源、竖屏适配、全屏任务栏/模式切换、Alt 导致输入停顿、弹窗不再出现、输入帧率被刷新打断、滑条支持直接输入与方向键。
+- **信息显示**:GPU 占用不再累加多块显卡;阶段时间条不反复重建闪跳;列表显示每层 NR 耗时;负载预算跟随半速节奏;首页卡片稳定更新副标题,减少重建时点击丢失并增加导航日志(未将未复现的 Xbox/PS5 误开报告宣称为已完全定位)。
+- **采集/串流**:美乐威 SDK 模式停止并行 DirectShow 视频以避免争用;ResizeBuffers 失败退避;修正采集颜色控制边界、MJPEG 丢帧过度重置历史、音频设备选择保存、源切换残留画面;采集/串流可以暂停再恢复;保存配对、解码路径与 Reflex 卸载修复。
+- **导出**:取消后可重试、队列顺序/条目状态、格式不兼容字幕处理、暂停时 ETA 继续走、重复 ETA、慢 GPU 帧被固定两秒超时误杀。现按设备状态等待并记录慢帧/故障,不将真实 GPU 卡死当作导出成功。
+- **OBS**:默认 GPU UI 下复现缩放崩溃和捕获 UI 而非视频;新兼容模式规避多交换链冲突。此前 Vulkan 方案弃用,不计入成果。
+- **图标**:EXE 新图标及 Qt 窗口/任务栏图标显式设置,解决任务栏默认占位图标。
+
+### 下载、验证与已知边界
+
+下载 `Veyra-2.0.0-win64-portable.zip`,完整解压运行 `veyra_qml_ui.exe`;保留旧版,勿用旧配置目录覆盖。新版操作、节点教程与架构见 README。附源码、依赖源码、运行清单与 SHA256。
+
+本地基底完成 19 组回归、10 项导出场景;OBS 候选四种增强组合 720 次缩放、8 轮最大化/还原通过,用户确认有效。最终开关重启三路径和实际 ZIP 解压播放短测通过。不同阶段证据分别记录,**不等于同一二进制已通过所有硬件和长期压力测试**。
+
+仍未解决/未验证:部分 RTX40 NR TDR、显存持续增长根因、5090 特定 XeSS 闪退/内容节奏重复帧、部分 GC573/4K X 行为、长时间运行、真实 HDR 屏幕与端到端延迟、跨设备串流/手柄;30/40 FG 与 SF-v2、RX9000 FSR4 ML 不以本机5070代验。参数重建可能短暂停顿。RTSS/游戏加加适配取消,请避免对 Veyra 注入。
+
+正式应用版本号不改变实验运行库边界:社区 NR、FG 优化内核等不是厂商认证;不宣称完整官方 DLSS 5 集成。允许用户替换 DLL,但不保证 ABI/驱动兼容。
+
+## English
+
+### New features and major improvements
+
+**1. Rebuilt interface.** New Home/recent/resume, Cinema, Professional List, Node canvas, Colour, Export and Settings; consistent dark design, icons, menus, confirmations and animations. New rounded gradient-black EXE/window/taskbar icon and updated screenshot/tutorial. Simplified/Traditional Chinese, English and Japanese; configurable UI scale, startup size, shortcuts, audio device and monitored GPU. Hideable cinema controls, fullscreen mode switching/quick controls/locking, click-to-pause, double-click fullscreen, seeking, aspect/rotation, original/enhanced comparison, SDR preview, screenshots and subtitle/audio controls.
+
+**2. Executable node editing and layered processing.** Add/connect/insert/disconnect/delete/duplicate/reset nodes; middle-pan, wheel zoom, fit and auto-layout. Up to four independent NR instances with individual parameters/resolution; multiple colour instances and supported ordering around a single SR. Duplicates start disconnected. Draft edits and the last valid runtime chain are separate. List/Node sessions, presets and settings persist independently; personal preset content choices/import/export/startup default replace imposed built-ins. Flow is shared after input, Video HDR precedes final FG, one FG backend is selected. This is not arbitrary branching. **Offline export is List-only; node export is deferred.** Global NR protection is List-only. Curves, mixer, wheels, B&W/calibration, group bypass/reset, parameter reset, LUTs and colour presets are connected to real processing.
+
+**3. Enhancement backends and diagnostics.** Lecram/SF-v2 NR selection across the chain; new configurations use SF-v2 on RTX20/30/40 and Lecram on RTX50, still experimental. DLSS FG 310.9.1 with attributed Transfusion compatibility; native RTX50 path retained, RTX30/40 hardware validation outstanding. DLSS 2/3/4/6× and XeSS 2/3/4× follow capability limits. Separate FSR3.1/FSR4 ML 2× entries; FSR4 is AMD-only and requires the actual matching provider. Added 5K/6K/7K SR choices, motion inputs, flow quality/AMD half-resolution, cadence/sync/queue/cap controls, output stabiliser, per-layer/node last-second GPU timings and frame-time/load displays. Crash dumps, device-removal/DRED, module inventory, capture frame age and staged VRAM recovery diagnostics improve investigation, not proof that hangs/leaks are fixed.
+
+**4. Sources and capture.** Moonlight/Sunshine PC discovery/manual hosts, PIN pairing, apps, identity persistence, input and statistics; Sunshine is installed separately. Unofficial Xbox device-code login, session API/native WebRTC and UI. Streaming hardware AV1/HEVC, pairing retention and high-bitrate defaults; all sources reuse the enhancement engine. Magewell Pro Capture low-latency SDK option, reduced native capture upload copies, parallel MJPEG decode/direct NV12 and reduced extra queueing under overload. Specific KUHAIMI27P/RTX5070 static tests measured capture-callback-to-Present-return improvements (2K60 NV12 ~1.95→0.90 ms; 4K30 ~3.2→1.47 ms). **These are internal software intervals, not card latency or screen-to-screen latency and not a universal device result.**
+
+**5. Export workflow.** Ordered editable multi-file queue, per-job snapshots, trim/thumbnails, MP4/MKV, typed bitrate, estimated size and one current-file ETA. Keep all/select audio and embedded subtitles; automatic retention skips incompatible tracks with a notice, explicit incompatible selections fail. Pause/cancel/retry/completion sound; default VBR8Mbps and closing playback/capture/streaming on export (optional). Offline export processes source frames fully; List-only and no implied new XeSS/FSR offline FG support.
+
+**6. OBS compatibility.** Persistent default-off Settings switch asks Yes/No to restart; Yes shuts down normally and relaunches, No applies next launch; active exports defer restart. Software UI avoids competing UI/video DXGI chains, while native GPU video/NR/SR/FG remain unchanged; some shadows/blur simplify. Game Capture targets video; use Windows10(1903+) Window Capture for the full UI. Not an RTSS/GamePP adaptation.
+
+### Bug fixes
+
+- **Layers/state:** stacked NR black frames/only one temporal instance, copied parameter isolation, List/Node contamination, mixed preset restoration, drafts changing live state, invalid FG multipliers and reset/slider binding synchronisation.
+- **FG/presentation:** independent FSR output textures and safer hot switching; rollback UI after rejected FSR4; XeSS temporary-iterator undefined behaviour/capability controls; low queue no longer changes NR/SR order; shallow vsync queue. Comparison explicitly reports FG paused.
+- **Windows/UI:** display/DPI crashes, picture covering controls/menus/tooltips, cinema bars/clipping, seek dragging the window, empty-source selection, portrait layout, fullscreen/taskbar/mode transitions, bare Alt stalls, disappearing dialogs, typed frame-rate resets; editable sliders and arrow keys.
+- **Readouts/navigation:** monitor one GPU instead of summing adapters; stable stage bars and per-layer NR timings; half-rate budget; stable Home cards and navigation logs. The un-reproduced Xbox/PS5 wrong-dialog report is not claimed conclusively diagnosed.
+- **Capture/streaming:** stop competing DirectShow video in Magewell SDK mode; resize-failure backoff; colour-control boundaries, excessive history resets on MJPEG drops, remembered audio selection, stale source picture, live-source pause/resume, pairing/decoding and Reflex unload fixes.
+- **Export:** cancellation retry, queue/job state, incompatible subtitle handling, paused/duplicate ETA and slow GPU frames incorrectly failing after two seconds. Device faults/timeouts remain explicit failures with diagnostics.
+- **OBS/icons:** compatibility mode avoids reproduced multi-swapchain resize crashes/UI-only capture. The failed Vulkan experiment was discarded. Explicit Qt window icons replace generic taskbar placeholders.
+
+### Download, validation and limitations
+
+Extract `Veyra-2.0.0-win64-portable.zip` into a new folder and run `veyra_qml_ui.exe`; retain the old version and do not overwrite with old settings. See README for the new workflow, node guide and architecture. Source/dependency archives, manifests and SHA256 are provided.
+
+The local base passed 19 regression groups and 10 export scenarios. The OBS candidate passed 720 resizes/eight maximise-restore cycles across four enhancement configurations and user validation. Final restart paths and an extracted-package playback smoke test passed. These are separately recorded stages, **not certification of all hardware or long-term stability for a single binary**.
+
+Outstanding: some RTX40 NR TDRs, VRAM growth root causes, specific RTX5090 XeSS/cadence reports, GC573/4K X cases, long runs, HDR displays/end-to-end latency and cross-device streaming/controllers. RTX30/40 FG/SF-v2 and RX9000 FSR4 ML require their own hardware validation. Rebuilding processing may stall briefly. RTSS/GamePP adaptation was cancelled; avoid injecting them into Veyra.
+
+The application version does not remove experimental runtime limits. Community NR/FG kernels are not vendor certification or a complete official DLSS5 integration. DLL replacement is allowed without an ABI/driver compatibility guarantee.
+
+## 支持与反馈 / Support & feedback
+
+<p align="center">
+ <img src="https://raw.githubusercontent.com/Likely7/Veyra-NRVideo/v1.4.0/docs/images/1.4.0/donate-wechat.jpg" alt="微信赞助" width="220">
+ &nbsp;&nbsp;&nbsp;&nbsp;
+ <img src="https://raw.githubusercontent.com/Likely7/Veyra-NRVideo/v2.0.0/docs/images/2.0.0/community-group.png" alt="Veyra 交流群 4" width="220">
+</p>
+
+左:微信赞助(自愿,不影响功能);右:交流群。群码按图片标注于 **2026-10-09 前**有效,过期请查看仓库更新。
+
+Left: optional donation; right: community group. QR valid before 2026-10-09.
diff --git a/docs/WORKLOG.md b/docs/WORKLOG.md
index 9d02039c..48963a7a 100644
--- a/docs/WORKLOG.md
+++ b/docs/WORKLOG.md
@@ -1,5 +1,10 @@
# Veyra 工作记录
+## 2026-10-02 夜 2.0.1
+
+- 用户授权发 2.0.1(README 不动,Release 正文保留 2.0.0 全部内容并加这次修复)。详情、现场日志结论与验证见 docs/RELEASE_2.0.1_2026-10-02.md。
+- 导出跨 GPU 重置分段续导并无损拼接(模拟设备移除实测 359/359 帧);爆显存检测到 NVIDIA App 画面插件 nvppex 时点名并停止无效重建;Xbox 记录完整 SDP。Xbox 根因、爆显存与插件的因果、8K 实卡续导均待用户。
+
## 2026-10-02 晚 2.0.0 修复更新(替换 Release 包,不改版本号)
- 用户授权修复并替换 GitHub 2.0.0 的包、README 顶部加 5 秒宣传动画。详情与验证见 docs/HOTFIX_2.0.0_2026-10-02.md。
diff --git a/i18n/catalog.json b/i18n/catalog.json
index 693a0c49..e2f2ac0b 100644
--- a/i18n/catalog.json
+++ b/i18n/catalog.json
@@ -1596,6 +1596,13 @@
"en": "{} failed (error {})",
"ja": "{}に失敗しました(エラー {})"
},
+ {
+ "zh": "{}显卡重置 {} 次,已分 {} 段导出并无损拼接",
+ "src": "src/engine/VideoExportJob.cpp",
+ "zh-TW": "{}顯示卡重置 {} 次,已分 {} 段匯出並無損拼接",
+ "en": "{}GPU reset {} time(s); exported in {} parts and joined without re-encoding",
+ "ja": "{}GPU リセット {} 回、{} 分割で書き出し再エンコードなしで結合しました"
+ },
{
"zh": "。请确认本机网络没有拦截 UDP,主机与本机最好在同一局域网。",
"src": "src/source/XboxSessionSource.cpp",
@@ -2892,6 +2899,27 @@
"en": "Analyzes speech and subtitle timing in the first 30 minutes",
"ja": "最初の 30 分の音声と字幕のタイミングを分析します"
},
+ {
+ "zh": "分段临时文件路径过长",
+ "src": "src/engine/ExportJobManager.cpp",
+ "zh-TW": "分段暫存檔路徑過長",
+ "en": "Part file path is too long",
+ "ja": "分割一時ファイルのパスが長すぎます"
+ },
+ {
+ "zh": "分段拼接失败",
+ "src": "src/engine/VideoExportJob.cpp",
+ "zh-TW": "分段拼接失敗",
+ "en": "Joining the parts failed",
+ "ja": "分割ファイルの結合に失敗しました"
+ },
+ {
+ "zh": "分段拼接失败({} 错误 {})",
+ "src": "src/engine/VideoExportJob.cpp",
+ "zh-TW": "分段拼接失敗({} 錯誤 {})",
+ "en": "Joining the parts failed ({} error {})",
+ "ja": "分割ファイルの結合に失敗しました({} エラー {})"
+ },
{
"zh": "分离中间调",
"src": "src/ui/QmlPlayerBridge.cpp",
@@ -4845,6 +4873,13 @@
"en": "Close what is playing when exporting",
"ja": "書き出し時に再生中のコンテンツを閉じる"
},
+ {
+ "zh": "导出时显卡多次被系统重置",
+ "src": "src/engine/ExportJobManager.cpp",
+ "zh-TW": "匯出時顯示卡多次被系統重置",
+ "en": "The GPU was reset several times during the export",
+ "ja": "書き出し中に GPU が何度もリセットされました"
+ },
{
"zh": "导出期间可以继续预览其他文件,会和导出抢显卡。",
"src": "qml/ExportPage.qml",
@@ -6736,6 +6771,13 @@
"en": "Could not create the export communication resources",
"ja": "書き出し用の通信リソースを作成できませんでした"
},
+ {
+ "zh": "无法创建拼接输出",
+ "src": "src/engine/VideoExportJob.cpp",
+ "zh-TW": "無法建立拼接輸出",
+ "en": "Cannot create the joined output",
+ "ja": "結合出力を作成できません"
+ },
{
"zh": "无法创建音频线程",
"src": "src/sink/CaptureAudioSession.cpp",
@@ -6785,6 +6827,13 @@
"en": "Could not connect to the host: ",
"ja": "ホストに接続できません:"
},
+ {
+ "zh": "无法复制轨道参数",
+ "src": "src/engine/VideoExportJob.cpp",
+ "zh-TW": "無法複製軌道參數",
+ "en": "Cannot copy the track parameters",
+ "ja": "トラックのパラメーターをコピーできません"
+ },
{
"zh": "无法建立串流连接(错误码 {})。",
"src": "src/source/MoonlightSessionSource.cpp",
@@ -6988,6 +7037,27 @@
"en": "The GPU, driver or runtime does not support the selected feature",
"ja": "GPU、ドライバー、またはランタイムが選択した機能に対応していません"
},
+ {
+ "zh": "显卡在导出时被系统重置(第 {} 次),前面已保存,正在从 {:.1f} 秒接着导出",
+ "src": "src/engine/ExportJobManager.cpp",
+ "zh-TW": "顯示卡在匯出時被系統重置(第 {} 次),前面已儲存,正在從 {:.1f} 秒接著匯出",
+ "en": "The GPU was reset during the export (time {}); the part so far is saved, continuing from {:.1f} s",
+ "ja": "書き出し中に GPU がリセットされました({} 回目)。ここまでは保存済みで、{:.1f} 秒から続けます"
+ },
+ {
+ "zh": "显卡在第 {} 帧被系统重置;前 {:.1f} 秒已保存,接着导出剩余部分",
+ "src": "src/engine/VideoExportJob.cpp",
+ "zh-TW": "顯示卡在第 {} 幀被系統重置;前 {:.1f} 秒已儲存,接著匯出剩餘部分",
+ "en": "The GPU was reset at frame {}; the first {:.1f} s are saved, exporting the rest",
+ "ja": "{} フレーム目で GPU がリセットされました。最初の {:.1f} 秒は保存済みで、残りを書き出します"
+ },
+ {
+ "zh": "显卡重置前后两段的编码参数不一致,无法无损拼接",
+ "src": "src/engine/VideoExportJob.cpp",
+ "zh-TW": "顯示卡重置前後兩段的編碼參數不一致,無法無損拼接",
+ "en": "The parts before and after the GPU reset have different encoder parameters and cannot be joined without re-encoding",
+ "ja": "GPU リセット前後の分割でエンコード設定が異なるため、再エンコードなしで結合できません"
+ },
{
"zh": "显卡驱动在第 {} 帧卡死并被系统重置(0x{:X})。40 系显卡开社区版 NR 时偶发;可关闭 NR、把 NR 内部分辨率调低或换光流后重试",
"src": "src/engine/VideoExportJob.cpp",
@@ -7009,6 +7079,13 @@
"en": "Could not drain while reclaiming VRAM",
"ja": "VRAM 回収時に排出できませんでした"
},
+ {
+ "zh": "显存在设置没变的情况下涨了 %1 GB。检测到 NVIDIA App 的画面插件(RTX HDR / 智能平滑运动 / RTX 动态鲜艳度)注入了 Veyra:它只在全屏时介入,这部分显存很可能由它占用,Veyra 重建也释放不了。请在 NVIDIA App → 图形 → 程序设置里为 Veyra 关闭这几项,或退出全屏;已占用的显存要重开 Veyra 才会释放",
+ "src": "src/ui/QmlPlayerBridge.cpp",
+ "zh-TW": "顯示記憶體在設定沒變的情況下增加了 %1 GB。偵測到 NVIDIA App 的畫面外掛(RTX HDR / 智慧平滑運動 / RTX 動態鮮豔度)注入了 Veyra:它只在全螢幕時介入,這部分顯示記憶體很可能由它佔用,Veyra 重建也釋放不了。請在 NVIDIA App → 圖形 → 程式設定中為 Veyra 關閉這幾項,或退出全螢幕;已佔用的顯示記憶體要重開 Veyra 才會釋放",
+ "en": "Video memory grew by %1 GB with no settings change. NVIDIA App's picture plug-in (RTX HDR / Smooth Motion / RTX Dynamic Vibrance) is injected into Veyra: it engages only in fullscreen, this memory is most likely held by it, and Veyra cannot release it by rebuilding. Turn these off for Veyra in NVIDIA App → Graphics → Program Settings, or leave fullscreen; memory already taken is released when Veyra is reopened",
+ "ja": "設定を変えていないのにビデオメモリが %1 GB 増えました。NVIDIA App の画面プラグイン(RTX HDR / Smooth Motion / RTX Dynamic Vibrance)が Veyra に挿入されています。全画面のときだけ動作し、このメモリはおそらくプラグインが確保していて、Veyra の再構築では解放できません。NVIDIA App → グラフィックス → プログラム設定で Veyra に対してこれらをオフにするか、全画面を解除してください。確保済みのメモリは Veyra を開き直すと解放されます"
+ },
{
"zh": "显存在设置没变的情况下涨了 %1 GB,已自动重建显示链回收显存(画面会闪一下)。如果反复出现:常见原因是 NVIDIA Smooth Motion、游戏加加、小飞机(RTSS)、显卡叠加层/即时重放或录屏软件在全屏时注入了本程序,请关掉它们后再试,并把日志发给我们(vram-watch)",
"src": "src/ui/QmlPlayerBridge.cpp",
@@ -7905,6 +7982,13 @@
"en": "Opening the capture device…",
"ja": "キャプチャーデバイスを開いています…"
},
+ {
+ "zh": "正在拼接显卡重置前后的各段",
+ "src": "src/engine/VideoExportJob.cpp",
+ "zh-TW": "正在拼接顯示卡重置前後的各段",
+ "en": "Joining the parts written before and after the GPU reset",
+ "ja": "GPU リセット前後の分割を結合しています"
+ },
{
"zh": "正在按队列顺序导出",
"src": "src/engine/ExportQueue.cpp",
@@ -8241,6 +8325,13 @@
"en": "No color preset selected",
"ja": "カラープリセットが選ばれていません"
},
+ {
+ "zh": "没有需要拼接的分段",
+ "src": "src/engine/VideoExportJob.cpp",
+ "zh-TW": "沒有需要拼接的分段",
+ "en": "No parts to join",
+ "ja": "結合する分割がありません"
+ },
{
"zh": "没能继续上次的 PC 串流,请在 PC 串流窗口里重新选择",
"src": "src/ui/QmlPlayerBridge.cpp",
@@ -13057,6 +13148,20 @@
"en": "; temporary file kept: ",
"ja": ";一時ファイルを保持しました:"
},
+ {
+ "zh": ";各段文件已保留:",
+ "src": "src/engine/VideoExportJob.cpp",
+ "zh-TW": ";各段檔案已保留:",
+ "en": "; the part files are kept: ",
+ "ja": "。分割ファイルは保存されています:"
+ },
+ {
+ "zh": ";已导出的部分保留在:",
+ "src": "src/engine/ExportJobManager.cpp",
+ "zh-TW": ";已匯出的部分保留在:",
+ "en": "; the exported parts are kept at: ",
+ "ja": "。書き出し済みの部分は次の場所にあります:"
+ },
{
"zh": ";当前显卡不能使用 DLSS NR,本次导出自动关闭 NR",
"src": "src/engine/VideoExportJob.cpp",
diff --git a/include/veyra/engine/EngineController.h b/include/veyra/engine/EngineController.h
index fa4193e7..9ebd7414 100644
--- a/include/veyra/engine/EngineController.h
+++ b/include/veyra/engine/EngineController.h
@@ -55,6 +55,8 @@ struct PlayerSnapshot {
// Video memory that kept growing with no settings change (MiB above the session's low point),
// 0 until the watchdog fires. Field logs 2026-10-01: +3 GB a minute in fullscreen only.
uint64_t vramRunawayMiB=0;
+ // Known injected components loaded when the growth was seen (gfx::riskyInjections).
+ std::wstring vramInjected;
std::wstring status=L"请打开视频或图片";
EnhancementSettings desired,applied;bool applying=false;
bool nrActive=false,srActive=false,fgActive=false;
diff --git a/include/veyra/engine/VideoExportJob.h b/include/veyra/engine/VideoExportJob.h
index 033688fd..e5e72982 100644
--- a/include/veyra/engine/VideoExportJob.h
+++ b/include/veyra/engine/VideoExportJob.h
@@ -1,9 +1,31 @@
#pragma once
#include "veyra/engine/EngineController.h"
#include <functional>
+#include <utility>
+#include <vector>
namespace veyra::engine {
struct ExportCounts {uint64_t source=0,generated=0,holds=0,encoded=0;};
+// Windows reset the GPU in the middle of a job (a driver hang, TDR). NGX cannot
+// start again in the same process after that, so the job does not retry here:
+// everything the encoder had returned is closed into a valid file, and the job
+// reports where a fresh process can carry on (ExportJobManager does that and the
+// last process joins the parts). Field report 2026-10-02: 8K NR exports on RTX 40
+// cards lost the whole file to one hang.
+struct ExportResume {
+ bool resumable=false;
+ double resumeAtSeconds=0; // source time the next part starts at (first frame at/after it)
+ double originSeconds=0; // source time of this part's first frame (its time zero)
+};
+// Parts already written by earlier processes of the same job, in order: the file
+// and the source time of its first frame. The finishing process joins them with
+// its own part into the output, without re-encoding.
+using ExportSegments=std::vector<std::pair<std::wstring,double>>;
bool exportVideo(const std::wstring& input,const std::wstring& output,PlayerOptions,bool hevc,
std::atomic<bool>& cancel,const std::function<void(double,const std::wstring&)>& progress,
- unsigned maxFrames=0,const std::function<bool()>& frameBoundary={},const std::function<void(const ExportCounts&)>& counts={});
+ unsigned maxFrames=0,const std::function<bool()>& frameBoundary={},const std::function<void(const ExportCounts&)>& counts={},
+ ExportResume* resume=nullptr,const ExportSegments& priorSegments={},unsigned resumeAttempt=0);
+// Joins export parts into `output` by copying packets: part i's timestamps move by
+// (its origin - the first part's origin). Every part must carry the same streams
+// and the same video parameter sets, otherwise nothing is written.
+bool joinExportSegments(const ExportSegments& parts,const std::wstring& output,bool matroska,std::wstring& error);
}
diff --git a/scripts/package-qml-release.py b/scripts/package-qml-release.py
index 147179fe..68705d31 100644
--- a/scripts/package-qml-release.py
+++ b/scripts/package-qml-release.py
@@ -146,8 +146,11 @@ def main():
for field in ('build', 'runtime_source', 'legacy_licenses', 'qt', 'qt_licenses', 'output'):
if getattr(args, field) is None:
p.error('Missing --' + field.replace('_', '-'))
- if not re.fullmatch(r'2\.0\.0(?:-[a-z0-9.-]+)?', args.label):
- raise ValueError('Expected version 2.0.0 or an explicit test suffix')
+ if not re.fullmatch(r'2\.0\.\d+(?:-[a-z0-9.-]+)?', args.label):
+ raise ValueError('Expected a 2.0.x version or an explicit test suffix')
+ # 2.0.x patch releases ship the 2.0.0 runtime lock unchanged; the notes follow the version.
+ version = args.label.split('-')[0]
+ notes = 'RELEASE_NOTES_' + version + '.md' if (ROOT / 'docs' / ('RELEASE_NOTES_' + version + '.md')).is_file() else 'RELEASE_NOTES_2.0.0.md'
if not args.output.resolve().is_relative_to(ARTIFACTS.resolve()):
raise ValueError('Candidate output must stay in the E: artifact tree')
stage = args.output / ('Veyra-' + args.label + '-win64-portable')
@@ -258,9 +261,9 @@ foreach($f in $lock.files) {
copy(ROOT / 'README_EN.md', 'README_EN.md')
for name in ('veyra-app-icon.png', 'veyra-2.0.0-promo.webp'):
copy(ROOT / 'assets' / name, 'assets/' + name)
- for name in ('RUNTIME_COMPONENTS_2.0.0.md', 'BUILD.md', 'BUILD_2.0.0.md', 'RELEASE_NOTES_2.0.0.md'):
+ for name in sorted({'RUNTIME_COMPONENTS_2.0.0.md', 'BUILD.md', 'BUILD_2.0.0.md', 'RELEASE_NOTES_2.0.0.md', notes}):
copy(ROOT / 'docs' / name, 'docs/' + name)
- copy(ROOT / 'docs/RELEASE_NOTES_2.0.0.md', 'RELEASE_NOTES.md')
+ copy(ROOT / 'docs' / notes, 'RELEASE_NOTES.md')
tree(ROOT / 'docs/images/2.0.0', 'docs/images/2.0.0')
records = []
@@ -273,7 +276,7 @@ foreach($f in $lock.files) {
records.append(dict(path=name, size=f.stat().st_size, sha256=digest(f)))
commit = subprocess.check_output(['git', '-C', str(ROOT), 'rev-parse', 'HEAD']).decode().strip()
changed = subprocess.check_output(['git', '-C', str(ROOT), 'status', '--porcelain']).decode('utf8')
- manifest = dict(schema=2, version='2.0.0', candidate=args.label, baseCommit=commit,
+ manifest = dict(schema=2, version=version, candidate=args.label, baseCommit=commit,
worktreeDirty=bool(changed), releaseReady=False, files=records)
if not args.no_archive:
manifest['sourceSnapshot'] = source_snapshot(args.output, args.label, digest(stage / 'veyra_qml_ui.exe'))
diff --git a/scripts/ui-check/export-resume.qml b/scripts/ui-check/export-resume.qml
new file mode 100644
index 00000000..6b158101
--- /dev/null
+++ b/scripts/ui-check/export-resume.qml
@@ -0,0 +1,24 @@
+ // ---- export continues after a GPU reset (field report 2026-10-02: 8K NR export lost to a TDR) ----
+ // Run with VEYRA_TEST_EXPORT_REMOVE_DEVICE_AT=<frame> so the first worker loses its D3D12 device.
+ Connections { target: veyra; function onNotice(text, isError) { veyra.logUi("uitest-notice", (isError ? "ERR " : "") + text) } }
+ Timer { interval: 150; running: true; repeat: true; onTriggered: veyra.logUi("uitest-tick", "") }
+ Timer {
+ interval: 1000; running: true; repeat: true
+ property int ticks: 0
+ property int finishedAt: 0
+ onTriggered: {
+ ++ticks
+ if (ticks === 2) { veyra.openUrl("@VIDEO@") }
+ if (ticks === 4) { root.goPage("pro"); if (@NR@) { if (veyra.nrLayers.length === 0) veyra.addEffect("nr"); veyra.setAllNrEnabled(true) } }
+ if (ticks === 6) { root.goPage("exp"); veyra.addExportFiles(["@VIDEO@"]) }
+ if (ticks === 8) { veyra.logUi("uitest", "UITEST_NOTE start target=" + veyra.exportTarget); veyra.startExport() }
+ if (ticks > 8 && ticks % 2 === 0)
+ veyra.logUi("uitest", "UITEST_NOTE running=" + veyra.exportRunning + " progress=" + veyra.exportProgress.toFixed(3) + " status=" + veyra.exportStatus)
+ if (ticks > 12 && !veyra.exportRunning && !finishedAt) {
+ finishedAt = ticks
+ veyra.logUi("uitest", "UITEST_NOTE finished status=" + veyra.exportStatus + " items=" + JSON.stringify(veyra.exportItems.map(i => i.state + ":" + i.note)))
+ }
+ if (finishedAt && ticks === finishedAt + 2) { veyra.logUi("uitest", "UITEST_DONE"); running = false }
+ if (ticks === 250) { veyra.logUi("uitest", "UITEST_FAIL export did not finish"); running = false }
+ }
+ }
diff --git a/scripts/ui-check/fullscreen-vram.qml b/scripts/ui-check/fullscreen-vram.qml
new file mode 100644
index 00000000..930b3651
--- /dev/null
+++ b/scripts/ui-check/fullscreen-vram.qml
@@ -0,0 +1,16 @@
+ // ---- fullscreen VRAM growth (field report 2026-10-02: +700 MiB/min only in fullscreen) ----
+ // Windowed for 40 s, fullscreen for @FULLS@ s, windowed again; [vram-watch]/[frame-rate] give the numbers.
+ Timer { interval: 150; running: true; repeat: true; onTriggered: veyra.logUi("uitest-tick", "") }
+ Timer {
+ interval: 1000; running: true; repeat: true
+ property int ticks: 0
+ readonly property int full: @FULLS@
+ onTriggered: {
+ ++ticks
+ if (ticks === 2) veyra.openUrl("@VIDEO@")
+ if (ticks === 4) { @EXTRA@ }
+ if (ticks === 40) { veyra.logUi("uitest", "UITEST_NOTE fullscreen on"); root.toggleFullscreen() }
+ if (ticks === 40 + full) { veyra.logUi("uitest", "UITEST_NOTE fullscreen off"); root.toggleFullscreen() }
+ if (ticks === 40 + full + 40) { veyra.logUi("uitest", "UITEST_DONE"); running = false }
+ }
+ }
diff --git a/src/engine/EngineController.cpp b/src/engine/EngineController.cpp
index 6b50a121..a8184de9 100644
--- a/src/engine/EngineController.cpp
+++ b/src/engine/EngineController.cpp
@@ -684,13 +684,21 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options,s
if(!vramFloor||usage<vramFloor)vramFloor=usage;
const uint64_t growth=usage-vramFloor,limit=std::max<uint64_t>(2048ull<<20,budget/4);
if(growth<=limit)return;
+ // NVIDIA App's picture plug-in (nvppex.dll: RTX HDR, Smooth Motion, RTX Dynamic
+ // Vibrance) and the driver present layer engage for fullscreen windows. With it
+ // loaded, field logs grew ~700 MiB/min only in fullscreen and neither a swapchain
+ // nor a graph rebuild gave any of it back (5060 Ti, 2026-10-02): the memory is not
+ // ours to free, and every rebuild only flashed the picture. Name it instead.
+ const std::wstring injected=gfx::riskyInjections();
+ const bool driverPlugin=injected.find(L"nvppex")!=std::wstring::npos||injected.find(L"NvPresent64")!=std::wstring::npos;
if(!vramWarned){
vramWarned=true;
veyra::log::warn("vram-watch",std::format("video memory grew {} MiB with no settings change (now {} of {} MiB budget); third-party modules: {}",
growth>>20,usage>>20,budget>>20,gfx::thirdPartyModules()));
- std::lock_guard lock(mutex_);snapshot_.vramRunawayMiB=growth>>20;
+ std::lock_guard lock(mutex_);snapshot_.vramRunawayMiB=growth>>20;snapshot_.vramInjected=injected;
}else veyra::log::warn("vram-watch",std::format("video memory grew {} MiB again (now {} MiB)",growth>>20,usage>>20));
- if(vramRecoveries<3){++vramRecoveries;vramRecoverStep=1;vramRecoverGrowth=growth;}
+ if(driverPlugin){vramFloor=usage;veyra::log::warn("vram-watch","NVIDIA App picture plug-in / present layer loaded; not rebuilding (it did not release this memory in field logs)");}
+ else if(vramRecoveries<3){++vramRecoveries;vramRecoverStep=1;vramRecoverGrowth=growth;}
else{vramFloor=usage;} // give up rebuilding; report again only on further growth
};
auto anchor=Clock::now(),statsStart=anchor;double anchorMs=0;uint64_t frames=0,sourceFrames=0;bool wasPaused=false;double discardBefore=0;
diff --git a/src/engine/ExportJobManager.cpp b/src/engine/ExportJobManager.cpp
index 22ff00bb..adbac237 100644
--- a/src/engine/ExportJobManager.cpp
+++ b/src/engine/ExportJobManager.cpp
@@ -8,6 +8,9 @@
#include <format>
#include <chrono>
#include <type_traits>
+#include <cmath>
+#include <utility>
+#include <vector>
#include <deque>
namespace veyra::engine {
namespace {
@@ -19,12 +22,14 @@ std::string utf8(std::wstring_view value) {
return result;
}
constexpr DWORD magic=0x56585931;
+// A job continues after at most three GPU resets: four parts.
+constexpr unsigned kMaxExportParts=4;
struct Shared {
// Version 3 carries the effect chain alongside the settings struct. The
// chain is fixed-capacity and trivially copyable, so it can cross the
// process boundary; a worker that sees another version refuses the job
// instead of reading a mismatched layout.
- DWORD signature=magic,version=6,bytes=sizeof(Shared); // export container / tracks / owned temporary
+ DWORD signature=magic,version=7,bytes=sizeof(Shared); // 7: resume after a GPU reset
EnhancementSettings settings;
EffectChain chain;
wchar_t input[32768]{},output[32768]{},temporary[32768]{};
@@ -36,6 +41,12 @@ struct Shared {
volatile LONG64 sourceFrames=0,generated=0,holds=0,encoded=0;
volatile LONG messageLock=0;wchar_t message[1024]{};
volatile LONG cancel=0,pause=0,watching=0,state=LONG(ExportState::Preparing),progress=0;
+ // GPU reset mid-job (exit code 4): the worker closed its part and says where to go on.
+ double resumeAtSeconds=0,segmentOriginSeconds=0;
+ // Parts written by earlier processes of this job; the finishing worker joins them.
+ unsigned priorCount=0,resumeAttempt=0;
+ double priorOrigins[kMaxExportParts]{};
+ wchar_t priorPaths[kMaxExportParts][2048]{};
};
static_assert(std::is_trivially_copyable_v<Shared>);
void close(HANDLE& h){if(h&&h!=INVALID_HANDLE_VALUE)CloseHandle(h);h=nullptr;}
@@ -63,7 +74,12 @@ struct ExportJobManager::Impl {
// Time spent paused is not encoding time: the estimate left it in, so a paused
// export's remaining time kept growing (field report 2026-10-02).
ULONGLONG pausedAt=0,pausedTotal=0;
- struct Request { std::wstring input,output; EnhancementSettings settings; bool hevc=false; unsigned maxFrames=0; int audioStreamIndex=-1; double trimStart=0,trimEnd=0; sink::ExportRateControl rateControl=sink::ExportRateControl::Cq; };
+ struct Request { std::wstring input,output; EnhancementSettings settings; bool hevc=false; unsigned maxFrames=0; int audioStreamIndex=-1; double trimStart=0,trimEnd=0; sink::ExportRateControl rateControl=sink::ExportRateControl::Cq; ExportMediaOptions media; };
+ // The running job, for relaunching after a GPU reset, and the parts it has written.
+ Request current;
+ std::vector<std::pair<std::wstring,double>> parts;
+ bool resuming=false;
+ void removeParts(){for(const auto& part:parts){std::wstring ignored;removeExportTemporaryFile(part.first,ignored);}parts.clear();}
std::deque<Request> queue;
uint64_t queueFailures=0;std::wstring lastQueueFailure;bool launchingQueued=false;
// Starts queued items in order until one launches; each refusal is recorded.
@@ -102,6 +118,7 @@ bool ExportJobManager::start(const std::wstring& input,const std::wstring& outpu
if(p_->shared&&WaitForSingleObject(p_->process,0)==WAIT_OBJECT_0)poll();
if(p_->shared){p_->snapshot.message=L"上一任务仍在回收,请等待取消完成";return false;}p_->clear();
if(!p_->launchingQueued){p_->queueFailures=0;p_->lastQueueFailure.clear();}
+ if(!p_->resuming){p_->removeParts();p_->current={input,output,settings,hevc,maxFrames,audioStreamIndex,trimStartSeconds,trimEndSeconds,rateControl,media};}
const auto failures=p_->queueFailures;const auto lastFailure=p_->lastQueueFailure;
p_->snapshot={};p_->snapshot.queueFailures=failures;p_->snapshot.lastQueueFailure=lastFailure;
auto fail=[&](const wchar_t* message){const DWORD error=GetLastError();p_->clear();p_->snapshot.state=ExportState::Failed;p_->snapshot.message=message;std::wstring cleanup;if(!removeExportTemporaryFile(p_->snapshot.temporaryPath,cleanup))p_->snapshot.message+=L"\n"+cleanup;log::error("export-worker",std::format("launch failed error={}",error));return false;};
@@ -122,6 +139,11 @@ bool ExportJobManager::start(const std::wstring& input,const std::wstring& outpu
s.audioStreamIndex=audioStreamIndex;
s.trimStartSeconds=trimStartSeconds;s.trimEndSeconds=trimEndSeconds;
s.media=media;wcscpy_s(s.temporary,p_->snapshot.temporaryPath.c_str());
+ s.resumeAttempt=unsigned(p_->parts.size());s.priorCount=unsigned(p_->parts.size());
+ for(size_t i=0;i<p_->parts.size()&&i<kMaxExportParts;++i){
+ if(p_->parts[i].first.size()>=2048)return fail(L"分段临时文件路径过长");
+ wcscpy_s(s.priorPaths[i],p_->parts[i].first.c_str());s.priorOrigins[i]=p_->parts[i].second;
+ }
wcscpy_s(s.input,input.c_str());wcscpy_s(s.output,output.c_str());
p_->job=CreateJobObjectW(nullptr,nullptr);JOBOBJECT_EXTENDED_LIMIT_INFORMATION limits{};limits.BasicLimitInformation.LimitFlags=JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE;
if(!p_->job||!SetInformationJobObject(p_->job,JobObjectExtendedLimitInformation,&limits,sizeof(limits)))return fail(L"无法建立导出进程生命周期");
@@ -163,11 +185,47 @@ ExportJobSnapshot ExportJobManager::poll(){
auto& s=*p_->shared;p_->snapshot.sourceFrames=InterlockedCompareExchange64(&s.sourceFrames,0,0);p_->snapshot.generated=InterlockedCompareExchange64(&s.generated,0,0);p_->snapshot.holds=InterlockedCompareExchange64(&s.holds,0,0);p_->snapshot.encoded=InterlockedCompareExchange64(&s.encoded,0,0);p_->snapshot.state=static_cast<ExportState>(InterlockedCompareExchange(&s.state,0,0));p_->snapshot.progress=InterlockedCompareExchange(&s.progress,0,0)/10000.0;p_->snapshot.queued=p_->queue.size();p_->snapshot.queuePosition=p_->queue.empty()?0:1;
if(p_->snapshot.progress>0.001&&p_->startTick){const auto now=GetTickCount64();const double elapsed=double(now-p_->startTick-p_->pausedTotal-(p_->pausedAt?now-p_->pausedAt:0))/1000.0;p_->snapshot.etaSeconds=std::max(0.0,elapsed*(1.0-p_->snapshot.progress)/p_->snapshot.progress);}else p_->snapshot.etaSeconds=0;
if(p_->cancelAt&&GetTickCount64()-p_->cancelAt>5000&&WaitForSingleObject(p_->process,0)==WAIT_TIMEOUT)TerminateJobObject(p_->job,3);
- if(WaitForSingleObject(p_->process,0)==WAIT_OBJECT_0){DWORD code=1;GetExitCodeProcess(p_->process,&code);p_->snapshot.state=code==0?ExportState::Succeeded:code==3||p_->cancelAt?ExportState::Cancelled:ExportState::Failed;if(code==0)p_->snapshot.progress=1;
+ if(WaitForSingleObject(p_->process,0)==WAIT_OBJECT_0){DWORD code=1;GetExitCodeProcess(p_->process,&code);
+ // Exit 4: the GPU was reset; the worker closed a valid part and named where to go
+ // on. NGX cannot start again in that process, so a fresh worker continues.
+ if(code==4&&!p_->cancelAt){
+ const double resumeAt=s.resumeAtSeconds,origin=s.segmentOriginSeconds;
+ const std::wstring part=p_->snapshot.temporaryPath;
+ const std::wstring workerMessage=s.message;
+ p_->parts.emplace_back(part,origin);
+ if(p_->parts.size()<kMaxExportParts&&std::isfinite(resumeAt)&&resumeAt>p_->current.trimStart&&
+ (p_->current.trimEnd<=0||resumeAt<p_->current.trimEnd)){
+ log::warn("export-resume",std::format("worker pid={} stopped at a GPU reset; part {} origin={:.3f}s; relaunching at {:.3f}s",p_->snapshot.workerPid,p_->parts.size(),origin,resumeAt));
+ // The queue follows a job by its id: the continuation keeps it.
+ const auto jobId=p_->snapshot.jobId;
+ p_->clear();
+ auto next=p_->current;next.trimStart=resumeAt;
+ p_->resuming=true;
+ const bool started=start(next.input,next.output,next.settings,next.hevc,next.maxFrames,next.audioStreamIndex,next.trimStart,next.trimEnd,next.rateControl,next.media);
+ p_->resuming=false;
+ if(started){
+ p_->snapshot.jobId=jobId;
+ p_->snapshot.message=std::format(L"显卡在导出时被系统重置(第 {} 次),前面已保存,正在从 {:.1f} 秒接着导出",p_->parts.size(),resumeAt);
+ return p_->snapshot;
+ }
+ }
+ // Not continued (too many resets, or the relaunch was refused): a failure that
+ // keeps every part it has, and says where they are.
+ std::wstring kept;for(const auto& saved:p_->parts)kept+=L"\n"+saved.first;
+ p_->snapshot.state=ExportState::Failed;
+ p_->snapshot.message=(workerMessage.empty()?std::wstring(L"导出时显卡多次被系统重置"):workerMessage)+L";已导出的部分保留在:"+kept;
+ log::error("export-resume",std::format("job not continued after {} parts",p_->parts.size()));
+ p_->parts.clear();
+ if(p_->shared)p_->clear();
+ return p_->snapshot;
+ }
+ p_->snapshot.state=code==0?ExportState::Succeeded:code==3||p_->cancelAt?ExportState::Cancelled:ExportState::Failed;if(code==0)p_->snapshot.progress=1;
// Preserve the worker's actual outcome, including codec substitutions.
const bool explained=(p_->snapshot.state==ExportState::Failed||p_->snapshot.state==ExportState::Succeeded)&&InterlockedCompareExchange(&s.state,0,0)==LONG(p_->snapshot.state)&&s.message[0];
p_->snapshot.message=explained?s.message:label(p_->snapshot.state);
- if(p_->snapshot.state==ExportState::Cancelled){std::wstring cleanup;if(!removeExportTemporaryFile(p_->snapshot.temporaryPath,cleanup))p_->snapshot.message+=L"\n"+cleanup;else p_->snapshot.message=L"导出已取消,可重新开始";}
+ if(p_->snapshot.state==ExportState::Cancelled){p_->removeParts();std::wstring cleanup;if(!removeExportTemporaryFile(p_->snapshot.temporaryPath,cleanup))p_->snapshot.message+=L"\n"+cleanup;else p_->snapshot.message=L"导出已取消,可重新开始";}
+ // The finishing worker joined and removed the parts; a failed one leaves them listed.
+ if(p_->snapshot.state==ExportState::Succeeded)p_->parts.clear();
const auto& final=p_->snapshot;
log::info("export-worker",std::format("finished jobId={} pid={} exit={} state={} source={} generated={} holds={} encoded={} log={}",final.jobId,final.workerPid,code,int(final.state),final.sourceFrames,final.generated,final.holds,final.encoded,std::filesystem::path(final.workerLog).string()));
log::info("export-worker",utf8(final.message));
@@ -187,7 +245,7 @@ ExportJobSnapshot ExportJobManager::poll(){
}
int runExportWorker(HANDLE mapping){
auto s=static_cast<Shared*>(MapViewOfFile(mapping,FILE_MAP_ALL_ACCESS,0,0,sizeof(Shared)));if(!s)return 1;
- if(s->signature!=magic||s->version!=6||s->bytes!=sizeof(Shared)||!s->media.valid()||s->audioStreamIndex< -1||s->rateControl>uint32_t(sink::ExportRateControl::Cq)||!std::isfinite(s->trimStartSeconds)||!std::isfinite(s->trimEndSeconds)||s->trimStartSeconds<0||s->trimEndSeconds<0||(s->trimEndSeconds>0&&s->trimEndSeconds<=s->trimStartSeconds)||!s->settings.validate().empty()||s->input[32767]||s->output[32767]||s->temporary[32767]||!s->temporary[0]){UnmapViewOfFile(s);CloseHandle(mapping);return 1;}
+ if(s->signature!=magic||s->version!=7||s->bytes!=sizeof(Shared)||!s->media.valid()||s->audioStreamIndex< -1||s->rateControl>uint32_t(sink::ExportRateControl::Cq)||!std::isfinite(s->trimStartSeconds)||!std::isfinite(s->trimEndSeconds)||s->trimStartSeconds<0||s->trimEndSeconds<0||(s->trimEndSeconds>0&&s->trimEndSeconds<=s->trimStartSeconds)||!s->settings.validate().empty()||s->input[32767]||s->output[32767]||s->temporary[32767]||!s->temporary[0]||s->priorCount>=kMaxExportParts){UnmapViewOfFile(s);CloseHandle(mapping);return 1;}
Logger::instance().openFile((runtime::logsDirectory()/std::format("export-worker-{}.log",GetCurrentProcessId())).wstring());
ExportStreams::enableWorkerLogging(GetEnvironmentVariableW(L"VEYRA_TEST_EXPORT_FFMPEG_DEBUG",nullptr,0)>0);
// The chain is the description of record for this job; the settings struct
@@ -207,12 +265,17 @@ int runExportWorker(HANDLE mapping){
};
auto options=PlayerOptions::from(settings);options.audioStreamIndex=s->audioStreamIndex;options.exportStartSeconds=s->trimStartSeconds;options.exportEndSeconds=s->trimEndSeconds;options.exportRateControl=static_cast<sink::ExportRateControl>(s->rateControl);
options.exportMedia=s->media;options.exportTemporaryPath=s->temporary;
+ ExportSegments prior;
+ for(unsigned i=0;i<s->priorCount;++i){s->priorPaths[i][2047]=0;prior.emplace_back(s->priorPaths[i],s->priorOrigins[i]);}
+ ExportResume resume;
bool ok=false;try{ok=exportVideo(s->input,s->output,options,s->hevc!=0,cancel,[&](double p,const std::wstring& message){if(InterlockedCompareExchange(&s->messageLock,1,0)==0){wcsncpy_s(s->message,message.c_str(),_TRUNCATE);InterlockedExchange(&s->messageLock,0);}
-InterlockedExchange(&s->progress,LONG(std::clamp(p,0.0,.999)*10000));if(p>=.99)InterlockedExchange(&s->state,LONG(ExportState::Finishing));},s->maxFrames,frameBoundary,[&](const ExportCounts& count){InterlockedExchange64(&s->sourceFrames,count.source);InterlockedExchange64(&s->generated,count.generated);InterlockedExchange64(&s->holds,count.holds);InterlockedExchange64(&s->encoded,count.encoded);});}catch(...){log::error("export-worker","unhandled job exception");}
+InterlockedExchange(&s->progress,LONG(std::clamp(p,0.0,.999)*10000));if(p>=.99)InterlockedExchange(&s->state,LONG(ExportState::Finishing));},s->maxFrames,frameBoundary,[&](const ExportCounts& count){InterlockedExchange64(&s->sourceFrames,count.source);InterlockedExchange64(&s->generated,count.generated);InterlockedExchange64(&s->holds,count.holds);InterlockedExchange64(&s->encoded,count.encoded);},&resume,prior,s->resumeAttempt);}catch(...){log::error("export-worker","unhandled job exception");}
+ const bool resumable=!ok&&!cancel&&resume.resumable;
+ if(resumable){s->resumeAtSeconds=resume.resumeAtSeconds;s->segmentOriginSeconds=resume.originSeconds;}
done=true;monitor.join();InterlockedExchange(&s->state,LONG(ok?ExportState::Succeeded:cancel?ExportState::Cancelled:ExportState::Failed));
// Deterministic lifetime regression hook: the real export already finished.
// No result is fabricated; only process exit is delayed, at most 2 seconds.
wchar_t delay[16]{};if(GetEnvironmentVariableW(L"VEYRA_TEST_EXPORT_EXIT_DELAY_MS",delay,16))Sleep(std::clamp(_wtoi(delay),0,2000));
- UnmapViewOfFile(s);CloseHandle(mapping);return ok?0:cancel?3:1;
+ UnmapViewOfFile(s);CloseHandle(mapping);return ok?0:cancel?3:resumable?4:1;
}
}
diff --git a/src/engine/VideoExportJob.cpp b/src/engine/VideoExportJob.cpp
index 9a03f163..d5402ec1 100644
--- a/src/engine/VideoExportJob.cpp
+++ b/src/engine/VideoExportJob.cpp
@@ -14,6 +14,9 @@
#include <chrono>
#include <cmath>
#include <deque>
+#include <cstring>
+#include <vector>
+#include <wrl/client.h>
extern "C" {
#include <libavformat/avformat.h>
#include <libavcodec/avcodec.h>
@@ -22,7 +25,8 @@ extern "C" {
}
namespace veyra::engine {
namespace { std::string utf8(const std::wstring& s){const int n=WideCharToMultiByte(CP_UTF8,0,s.data(),int(s.size()),nullptr,0,nullptr,nullptr);std::string r(n,0);WideCharToMultiByte(CP_UTF8,0,s.data(),int(s.size()),r.data(),n,nullptr,nullptr);return r;} }
-bool exportVideo(const std::wstring& input,const std::wstring& output,PlayerOptions options,bool hevc,std::atomic<bool>& cancel,const std::function<void(double,const std::wstring&)>& progress,unsigned maxFrames,const std::function<bool()>& frameBoundary,const std::function<void(const ExportCounts&)>& counts){
+bool exportVideo(const std::wstring& input,const std::wstring& output,PlayerOptions options,bool hevc,std::atomic<bool>& cancel,const std::function<void(double,const std::wstring&)>& progress,unsigned maxFrames,const std::function<bool()>& frameBoundary,const std::function<void(const ExportCounts&)>& counts,ExportResume* resume,const ExportSegments& priorSegments,unsigned resumeAttempt){
+ if(resume)*resume={};
if(!std::isfinite(options.exportStartSeconds)||!std::isfinite(options.exportEndSeconds)||options.exportStartSeconds<0||options.exportEndSeconds<0||(options.exportEndSeconds>0&&options.exportEndSeconds<=options.exportStartSeconds)){progress(0,L"导出剪辑范围无效");return false;}
if(std::filesystem::exists(output)){progress(0,L"目标文件已存在,请使用其他名称");return false;}
if(cancel){progress(0,L"导出已取消");return false;}
@@ -204,6 +208,11 @@ bool exportVideo(const std::wstring& input,const std::wstring& output,PlayerOpti
// completion back, standing in for a GPU that is slow but alive. Unset in normal use.
int slowFrameIndex=-1,slowFrameMs=0;
{wchar_t hook[32]{};if(GetEnvironmentVariableW(L"VEYRA_TEST_EXPORT_SLOW_FRAME",hook,32)&&swscanf_s(hook,L"%d:%d",&slowFrameIndex,&slowFrameMs)!=2)slowFrameIndex=-1;slowFrameMs=std::clamp(slowFrameMs,0,40000);}
+ // Acceptance hook: VEYRA_TEST_EXPORT_REMOVE_DEVICE_AT=<source index> removes the D3D12
+ // device at that frame in the first process of a job, standing in for a driver reset.
+ int removeDeviceIndex=-1;
+ {wchar_t hook[16]{};if(resumeAttempt==0&&GetEnvironmentVariableW(L"VEYRA_TEST_EXPORT_REMOVE_DEVICE_AT",hook,16))removeDeviceIndex=_wtoi(hook);}
+ bool deviceLost=false;uint32_t removedReason=0;
const uint32_t multiplier=options.fg?options.fgMultiplier:1u;
auto encodeAt=[&](unsigned slot,bool generated,double seconds){
const int64_t timeUs=std::max(lastOutputUs+1,int64_t(std::llround(seconds*1000000)));
@@ -224,6 +233,10 @@ bool exportVideo(const std::wstring& input,const std::wstring& output,PlayerOpti
pts=sourceCount?previousPts+sourceInterval:0;++repairedTimestamps;
if(repairedTimestamps<=5)veyra::log::warn("export-timeline",std::format("timestamp repaired source={} raw={} output={}",sourceCount,sourcePts,pts));
}
+ if(removeDeviceIndex>=0&&sourceCount==uint64_t(removeDeviceIndex)){
+ Microsoft::WRL::ComPtr<ID3D12Device5> device5;
+ if(SUCCEEDED(ctx.device()->QueryInterface(IID_PPV_ARGS(&device5)))){device5->RemoveDevice();veyra::log::warn("export","test hook: D3D12 device removed at this frame");}
+ }
pipeline::EnhanceGraph::FrameOutputs out;if(!graph.process(frame,(pts+videoOriginSeconds)*1000,sourceCount==0||repairPts||pipeline::breaksHistory(packet.flags),out,packet.sequence,&packet.colorInfo,&packet.hardwareSurface,false)){error=true;break;}
// One frame's GPU work. A fixed 2 s limit failed whole exports on a frame that
// was only slow (8K NR + optical flow + NVENC near the VRAM budget; field log
@@ -236,10 +249,10 @@ bool exportVideo(const std::wstring& input,const std::wstring& output,PlayerOpti
const auto now=std::chrono::steady_clock::now();
if(now>=nextHealthCheck){
nextHealthCheck=now+std::chrono::milliseconds(250);
- uint32_t removed=0;
- if(!ctx.checkDeviceAlive(removed)){
+ if(!ctx.checkDeviceAlive(removedReason)){
ctx.reportDeviceFailure("export-frame",ring.lastSignaledValue());
- error=true;failureReason=std::format(L"显卡驱动在第 {} 帧卡死并被系统重置(0x{:X})。40 系显卡开社区版 NR 时偶发;可关闭 NR、把 NR 内部分辨率调低或换光流后重试",sourceCount+1,removed);
+ deviceLost=true;
+ error=true;failureReason=std::format(L"显卡驱动在第 {} 帧卡死并被系统重置(0x{:X})。40 系显卡开社区版 NR 时偶发;可关闭 NR、把 NR 内部分辨率调低或换光流后重试",sourceCount+1,removedReason);
break;
}
}
@@ -272,6 +285,26 @@ bool exportVideo(const std::wstring& input,const std::wstring& output,PlayerOpti
++sourceCount;if(counts)counts({sourceCount,generatedCount,holdCount,uint64_t(written)});const double clipDuration=requestedEnd>0?requestedEnd-requestedStart:std::max(0.001,info.duration.toDouble()-videoOriginSeconds);progress(clipDuration>0?std::clamp(pts/clipDuration,0.0,.99):0,std::format(L"正在导出:{}张源帧 / {}张编码帧({})",sourceCount,outputIndex,encoderName));
if(maxFrames&&sourceCount>=maxFrames)break;
}
+ // Submission or encoding can also be the first call to see the reset.
+ if(error&&!cancel&&!deviceLost&&!ctx.checkDeviceAlive(removedReason)){
+ ctx.reportDeviceFailure("export-frame",ring.lastSignaledValue());
+ deviceLost=true;
+ failureReason=std::format(L"显卡驱动在第 {} 帧卡死并被系统重置(0x{:X})。40 系显卡开社区版 NR 时偶发;可关闭 NR、把 NR 内部分辨率调低或换光流后重试",sourceCount+1,removedReason);
+ }
+ if(deviceLost&&!cancel&&resume&&(written>0||pendingVideo->size)){
+ // Close what the encoder already returned into a valid file; the lost device is
+ // not asked to drain. The next part starts half a frame after the last written
+ // frame, so the following source frame is neither repeated nor lost to rounding.
+ const double frameSeconds=sourceInterval/multiplier;
+ const int64_t endUs=pendingVideo->size?pendingVideo->pts+std::max<int64_t>(1,std::llround(frameSeconds*1000000)):std::llround(audioEndSeconds*1000000);
+ if(flushVideo(endUs)&&writeAudioUntil(audioEndSeconds,true)&&av_write_trailer(mux)>=0){
+ resume->resumable=true;resume->originSeconds=videoOriginSeconds;
+ resume->resumeAtSeconds=videoOriginSeconds+audioEndSeconds-frameSeconds*0.5;
+ failureReason=std::format(L"显卡在第 {} 帧被系统重置;前 {:.1f} 秒已保存,接着导出剩余部分",sourceCount+1,audioEndSeconds);
+ veyra::log::warn("export-resume",std::format("device lost at source={} written={} part ends {:.3f}s; resume at source {:.3f}s, part origin {:.3f}s",
+ sourceCount,written,audioEndSeconds,resume->resumeAtSeconds,videoOriginSeconds));
+ } else veyra::log::error("export-resume","the part written before the device loss could not be closed; not resumable");
+ }
if(error||cancel)break;
if(options.fg&&lastReal)for(uint32_t j=1;j<multiplier;++j){if(!encodeAt(lastReal->slot,false,previousPts+sourceInterval*j/multiplier)){error=true;break;}++holdCount;}
if(error)break;
@@ -289,6 +322,25 @@ bool exportVideo(const std::wstring& input,const std::wstring& output,PlayerOpti
}while(false); }catch(const std::exception& e){veyra::log::error("export",std::format("exception: {}",e.what()));failureReason=L"导出异常,请查看诊断";ok=false;}
encoder.reset();if(mux){if(mux->pb){const int rc=avio_closep(&mux->pb);if(rc<0){failAv(L"刷新并关闭输出文件",rc);ok=false;}}avformat_free_context(mux);}
ring.drainQueue();graph.shutdown();source.close();ring.shutdown();ctx.shutdown();
+ // Earlier processes of this job stopped at a GPU reset: join their parts and this
+ // one into the output. The parts are removed only once the joined file is complete.
+ std::wstring finished=partial;
+ if(ok&&!priorSegments.empty()){
+ progress(.999,L"正在拼接显卡重置前后的各段");
+ auto parts=priorSegments;parts.emplace_back(partial,videoOriginSeconds);
+ const auto joined=partial+L".joined";
+ std::wstring joinError;
+ ok=!cancel&&joinExportSegments(parts,joined,options.exportMedia.container==ExportContainer::Matroska,joinError);
+ if(ok){
+ for(const auto& part:parts){std::error_code ec;std::filesystem::remove(part.first,ec);}
+ finished=joined;
+ fgNote+=std::format(L"{}显卡重置 {} 次,已分 {} 段导出并无损拼接",fgNote.empty()?L"":L";",priorSegments.size(),parts.size());
+ } else {
+ std::error_code ec;std::filesystem::remove(joined,ec);
+ std::wstring kept;for(const auto& part:parts)kept+=L"\n"+part.first;
+ failureReason=(joinError.empty()?std::wstring(L"分段拼接失败"):joinError)+L";各段文件已保留:"+kept;
+ }
+ }
if(ok){
progress(.999,L"正在保存正式文件");
// Bounded deterministic acceptance hook around the real final rename.
@@ -298,7 +350,7 @@ bool exportVideo(const std::wstring& input,const std::wstring& output,PlayerOpti
const auto deadline=GetTickCount64()+std::clamp(_wtoi(delayText),0,2000);
while(!cancel&&GetTickCount64()<deadline)Sleep(5);
}
- ok=!cancel&&MoveFileExW(partial.c_str(),output.c_str(),MOVEFILE_WRITE_THROUGH)!=FALSE;
+ ok=!cancel&&MoveFileExW(finished.c_str(),output.c_str(),MOVEFILE_WRITE_THROUGH)!=FALSE;
if(!ok&&!cancel){const DWORD error=GetLastError();failureReason=std::format(L"视频已编码,但保存文件名失败(Windows错误 {});可保留partial文件",error);veyra::log::error("export-rename",std::format("MoveFileExW failed error={} partial={}",error,utf8(partial)));}
if(ok)veyra::log::info("export","encoder drained, mux closed, output saved; no post-export decoding");
}
@@ -317,4 +369,93 @@ bool exportVideo(const std::wstring& input,const std::wstring& output,PlayerOpti
}
return ok;
}
+
+bool joinExportSegments(const ExportSegments& parts,const std::wstring& output,bool matroska,std::wstring& error){
+ if(parts.size()<2){error=L"没有需要拼接的分段";return false;}
+ std::vector<AVFormatContext*> inputs(parts.size(),nullptr);
+ AVFormatContext* out=nullptr;AVPacket* packet=av_packet_alloc();
+ bool ok=false;
+ auto failAv=[&](const char* stage,int code){
+ char text[AV_ERROR_MAX_STRING_SIZE]{};av_strerror(code,text,sizeof(text));
+ veyra::log::error("export-join",std::format("{} failed code={} detail={}",stage,code,text));
+ error=std::format(L"分段拼接失败({} 错误 {})",std::wstring(stage,stage+std::strlen(stage)),code);
+ return false;
+ };
+ do {
+ if(!packet)break;
+ for(size_t i=0;i<parts.size();++i){
+ int rc=avformat_open_input(&inputs[i],utf8(parts[i].first).c_str(),nullptr,nullptr);
+ if(rc<0){failAv("open part",rc);break;}
+ rc=avformat_find_stream_info(inputs[i],nullptr);
+ if(rc<0){failAv("read part",rc);break;}
+ }
+ if(!error.empty())break;
+ const auto* first=inputs[0];
+ // Same streams in the same order, and identical codec headers: the joined file
+ // carries the first part's headers for all of them.
+ bool same=true;
+ for(size_t i=1;i<inputs.size()&&same;++i){
+ if(inputs[i]->nb_streams!=first->nb_streams){same=false;break;}
+ for(unsigned s=0;s<first->nb_streams;++s){
+ const auto* a=first->streams[s]->codecpar;const auto* b=inputs[i]->streams[s]->codecpar;
+ if(a->codec_type!=b->codec_type||a->codec_id!=b->codec_id){same=false;break;}
+ if(a->codec_type==AVMEDIA_TYPE_VIDEO&&(a->width!=b->width||a->height!=b->height||a->extradata_size!=b->extradata_size||
+ (a->extradata_size>0&&std::memcmp(a->extradata,b->extradata,size_t(a->extradata_size))!=0))){same=false;break;}
+ }
+ }
+ if(!same){
+ error=L"显卡重置前后两段的编码参数不一致,无法无损拼接";
+ veyra::log::error("export-join","parts differ in streams or video parameter sets; not joined");
+ break;
+ }
+ if(avformat_alloc_output_context2(&out,nullptr,matroska?"matroska":"mp4",utf8(output).c_str())<0||!out){error=L"无法创建拼接输出";break;}
+ for(unsigned s=0;s<first->nb_streams;++s){
+ AVStream* stream=avformat_new_stream(out,nullptr);
+ if(!stream||avcodec_parameters_copy(stream->codecpar,first->streams[s]->codecpar)<0){error=L"无法复制轨道参数";break;}
+ stream->codecpar->codec_tag=0;
+ stream->time_base=first->streams[s]->time_base;
+ stream->avg_frame_rate=first->streams[s]->avg_frame_rate;
+ stream->disposition=first->streams[s]->disposition;
+ av_dict_copy(&stream->metadata,first->streams[s]->metadata,0);
+ }
+ if(!error.empty())break;
+ int rc=avio_open(&out->pb,utf8(output).c_str(),AVIO_FLAG_WRITE);
+ if(rc<0){failAv("create output",rc);break;}
+ rc=avformat_write_header(out,nullptr);
+ if(rc<0){failAv("write header",rc);break;}
+ std::vector<int64_t> lastDts(first->nb_streams,AV_NOPTS_VALUE);
+ uint64_t copied=0,dropped=0;
+ for(size_t i=0;i<inputs.size()&&error.empty();++i){
+ const int64_t offsetUs=std::llround((parts[i].second-parts[0].second)*1000000.0);
+ while((rc=av_read_frame(inputs[i],packet))>=0){
+ const unsigned s=unsigned(packet->stream_index);
+ if(s>=first->nb_streams){av_packet_unref(packet);continue;}
+ AVStream* to=out->streams[s];
+ av_packet_rescale_ts(packet,inputs[i]->streams[s]->time_base,to->time_base);
+ const int64_t offset=av_rescale_q(offsetUs,AVRational{1,1000000},to->time_base);
+ if(packet->pts!=AV_NOPTS_VALUE)packet->pts+=offset;
+ if(packet->dts!=AV_NOPTS_VALUE)packet->dts+=offset;
+ // A packet that does not move forward (audio overlapping the cut) is dropped:
+ // the earlier part already carries that time.
+ if(packet->dts!=AV_NOPTS_VALUE&&lastDts[s]!=AV_NOPTS_VALUE&&packet->dts<=lastDts[s]){++dropped;av_packet_unref(packet);continue;}
+ if(packet->dts!=AV_NOPTS_VALUE)lastDts[s]=packet->dts;
+ packet->pos=-1;
+ rc=av_interleaved_write_frame(out,packet);
+ if(rc<0){failAv("write packet",rc);break;}
+ ++copied;
+ }
+ if(rc<0&&rc!=AVERROR_EOF&&error.empty())failAv("read packet",rc);
+ }
+ if(!error.empty())break;
+ rc=av_write_trailer(out);
+ if(rc<0){failAv("write index",rc);break;}
+ veyra::log::info("export-join",std::format("joined parts={} packets={} droppedOverlap={}",parts.size(),copied,dropped));
+ ok=true;
+ } while(false);
+ av_packet_free(&packet);
+ for(auto*& input:inputs)if(input)avformat_close_input(&input);
+ if(out){if(out->pb){const int rc=avio_closep(&out->pb);if(rc<0&&ok)ok=failAv("close output",rc);}avformat_free_context(out);}
+ if(ok)error.clear();
+ return ok;
+}
}
diff --git a/src/ui/QmlPlayerBridge.cpp b/src/ui/QmlPlayerBridge.cpp
index 8842fa41..94c219b0 100644
--- a/src/ui/QmlPlayerBridge.cpp
+++ b/src/ui/QmlPlayerBridge.cpp
@@ -898,7 +898,13 @@ QmlPlayerBridge::QmlPlayerBridge(engine::EngineController& engine, std::filesyst
if(impl_->poll()){emit settingsChanged();emit chainChanged();}
if (impl_->snapshot.vramRunawayMiB && impl_->vramNoticeSession != impl_->snapshot.sessionId) {
impl_->vramNoticeSession = impl_->snapshot.sessionId;
- emit notice(tr("显存在设置没变的情况下涨了 %1 GB,已自动重建显示链回收显存(画面会闪一下)。"
+ const auto& injected = impl_->snapshot.vramInjected;
+ if (injected.find(L"nvppex") != std::wstring::npos || injected.find(L"NvPresent64") != std::wstring::npos)
+ emit notice(tr("显存在设置没变的情况下涨了 %1 GB。检测到 NVIDIA App 的画面插件(RTX HDR / 智能平滑运动 / RTX 动态鲜艳度)注入了 Veyra:"
+ "它只在全屏时介入,这部分显存很可能由它占用,Veyra 重建也释放不了。请在 NVIDIA App → 图形 → 程序设置里为 Veyra 关闭这几项,"
+ "或退出全屏;已占用的显存要重开 Veyra 才会释放")
+ .arg(impl_->snapshot.vramRunawayMiB / 1024.0, 0, 'f', 1), true);
+ else emit notice(tr("显存在设置没变的情况下涨了 %1 GB,已自动重建显示链回收显存(画面会闪一下)。"
"如果反复出现:常见原因是 NVIDIA Smooth Motion、游戏加加、小飞机(RTSS)、显卡叠加层/即时重放"
"或录屏软件在全屏时注入了本程序,请关掉它们后再试,并把日志发给我们(vram-watch)")
.arg(impl_->snapshot.vramRunawayMiB / 1024.0, 0, 'f', 1), true);
@@ -998,6 +1004,9 @@ QmlPlayerBridge::QmlPlayerBridge(engine::EngineController& engine, std::filesyst
// The driver's presentation layer; it carries NVIDIA Smooth Motion, which only
// engages for fullscreen windows (suspected in the fullscreen-only VRAM growth).
{L"NvPresent64.dll", "NVIDIA present layer (Smooth Motion)"},
+ // NVIDIA App's picture plug-in (RTX HDR / Smooth Motion / RTX Dynamic Vibrance): in
+ // every fullscreen VRAM-growth log and in two capture crashes (2026-10-02).
+ {L"nvppex.dll", "NVIDIA App picture plug-in (RTX HDR / Smooth Motion / Dynamic Vibrance)"},
};
static bool loggedOthers[std::size(others)]{};
for (size_t k = 0; k < std::size(others); ++k)
diff --git a/src/xbox/WebRtcSession.cpp b/src/xbox/WebRtcSession.cpp
index 52034945..574884fa 100644
--- a/src/xbox/WebRtcSession.cpp
+++ b/src/xbox/WebRtcSession.cpp
@@ -197,6 +197,9 @@ bool WebRtcSession::start(Signaling& signaling, std::string* error, std::chrono:
if (GetEnvironmentVariableA("VEYRA_XBOX_RTC_DEBUG", nullptr, 0) > 0) log::info("xbox", "local candidate [" + text + "] mid " + c.mid());
}
log::info("xbox", "offer codecs:\n" + describeCodecs(offer));
+ // The whole offer (no candidates, no account data): a refused offer can then be compared
+ // line by line with a client that connects (field report 2026-10-02).
+ log::info("xbox", "offer sdp:\n" + offer);
std::string answer;
try {
@@ -205,6 +208,7 @@ bool WebRtcSession::start(Signaling& signaling, std::string* error, std::chrono:
return fail(std::string("SDP exchange: ") + e.what());
}
log::info("xbox", "answer codecs:\n" + describeCodecs(answer));
+ log::info("xbox", "answer sdp:\n" + answer);
try {
pc_->setRemoteDescription(rtc::Description(answer, rtc::Description::Type::Answer));
} catch (const std::exception& e) {