Skip to content

fix: 三个录制稳定性修复 (#500 / #504 + ffmpeg 断线重连失效) - #516

Open
zzuu080603 wants to merge 4 commits into
ihmily:mainfrom
zzuu080603:fix/recording-fixes
Open

zzuu080603 wants to merge 4 commits into
ihmily:mainfrom
zzuu080603:fix/recording-fixes

Conversation

@zzuu080603

Copy link
Copy Markdown

概述

三个小而关键的修复,均通过代码审查 + 命令构建实测验证(ruff 通过):

1️⃣ ffmpeg 断线重连选项从未生效(影响所有平台,helps #502)

base.py 中 -reconnect_delay_max / -reconnect_streamed / -reconnect_at_eof 位于 -i 之后(输出选项区),这三个是 HTTP 协议的输入选项,放在那里会被 ffmpeg 静默丢弃——因此网络闪断时的自动重连从未生效过。

修复:移到 -i 之前的输入选项区;仅对 http(s) URL 添加(rtmp 等协议无此选项,避免报错)。已实测验证生成的完整命令中三项正确位于 -i 前,headers/proxy 插入位置不受影响。

... -fflags +discardcorrupt+igndts -re -reconnect_delay_max 60 -reconnect_streamed -reconnect_at_eof -i https://... ✅

2️⃣ #500 下播状态检查覆盖手动设置的主播名

check_if_live 下播分支中,只要标题带 [直播中] 标记就会用平台返回的 anchor_name 覆盖 streamer_name 并持久化——用户手动填写的名称被静默丢弃,重启也无法恢复。

修复:仅当名称仍为默认占位符「直播间」时才自动填入平台名;自定义名一律保留,标题也改为基于保留后的名称生成。

3️⃣ #504 「仅通知不录制」房间手动点击录制按钮只显示假录制

on_toggle_recording 调用 check_if_live(其内部因 only_notify_no_record 跳过启动 ffmpeg),随后又调用 start_update 只设置了 is_recording 标志——UI 显示录制中、计时走动,但 ffmpeg 从未启动、无文件产生。

修复:check_if_live 增加 manual_start 参数,手动点击时绕过 only-notify 拦截、真正启动录制;删除外层多余的 start_update 调用(正是假录制的根源)。周期检测等其他调用点行为不变。

测试

  • ✅ ffmpeg 命令构建实测:https/http URL 的 reconnect 选项位于 -i 前,rtmp URL 不添加,proxy/headers 插入位置回归通过
  • ✅ ruff 检查通过

Fixes #500
Fixes #504

qinzihan added 4 commits November 10, 2026 08:48
…lly works

The three reconnect options sat after -i (output options area) where
ffmpeg silently ignores them, so automatic reconnection on network
drops never worked for any platform. They are HTTP-protocol input
options and must precede -i; only added for http(s) URLs to avoid
errors on rtmp inputs. Helps ihmily#502 (douyu 5-min disconnects).
…y#500)

The offline branch of check_if_live updated streamer_name to the
platform anchor whenever the display title carried the live marker,
silently discarding the name the user typed and persisting the
overwrite. Only auto-fill the name while it still holds the default
placeholder; custom names (and titles built from them) are kept.
…d rooms (ihmily#504)

For rooms with only_notify_no_record enabled, on_toggle_recording called
check_if_live (which skips starting ffmpeg) and then start_update, which
only flips the is_recording flag — the card showed a fake recording with
no file. Pass manual_start=True so check_if_live bypasses the setting
and launches ffmpeg itself; drop the redundant manual start_update call.
-reconnect_streamed followed directly by another option made ffmpeg parse
the next option name as its value ("Unable to parse ... as boolean") and
refuse to start — every http(s) recording would have failed to launch.
Verified by actually executing the builder command against a local HTTP
source this time; with explicit values it records normally (exit 0).
@zzuu080603

Copy link
Copy Markdown
Author

发现并已修复本 PR 引入的一个启动失败问题:布尔选项 -reconnect_streamed 紧跟 -reconnect_at_eof 时,ffmpeg 会把下一个选项名当作它的值解析(Unable to parse ... as boolean),导致所有 http(s) 录制无法启动。已在最新 commit 中为布尔项添加显式值 1,并用真实 ffmpeg 对本地 HTTP 源实际执行了 builder 生成的完整命令验证(exit 0,正常录制)。抱歉引入,感谢审查。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant