b2b92e6fee1307d2baad8128986c718a357c4201
* feat(hook): built-in remux:mp4 hook + activate segment_processor stage
B站 transcoder rejects raw .ts uploads with PTS jumps ("您的视频未能成功
转码 ... 该视频内部存在时间戳跳变"), which is common on HLS reconnects
mid-segment. The fix is to feed it an mp4 with monotonic PTS — a plain
ffmpeg copy-remux is enough.
Add a built-in `HookStep::Remux { remux: String }` variant that runs
`ffmpeg -fflags +genpts+igndts -c copy -bsf:a aac_adtstoasc
-movflags +faststart -avoid_negative_ts make_zero` on .ts/.m2ts inputs.
Lossless and idempotent (reuses existing .mp4 sibling). Currently
target="mp4" only.
To make this useful, segment_processor (defined in config but never
previously invoked) is now executed in pipeline_upload_videos BEFORE
each upload_single_file. That's the right stage for ts→mp4 — must
run before pre_upload, not after.
Path-mutating processor pipeline:
- new execute_paths(&mut Vec<PathBuf>) API on HookStep
- new process_video_paths helper
- Remux replaces .ts entries with the new .mp4 entries so downstream
stages (upload, postprocessor) see the right paths.
The legacy execute(&[&Path]) path stays for postprocessor-style steps
that don't mutate the working set.
Config form:
segment_processor:
- {remux: "mp4"}
Tests cover YAML/JSON deserialization of all 4 HookStep variants
and Remux skipping non-.ts inputs.
* fix(upload): 单段 segment_processor / upload 失败不再拖死整批
之前 pipeline_upload_videos 里两个 ? 把单段失败直接抛到
process_with_upload,让后续 submit + execute_postprocessor(含 rm)
全部跳过。在磁盘紧的场景下,ffmpeg remux 写 mp4 header 时遇到
"No space left on device" → segment_processor Err → 整个直播会话已
成功上传的段也不会触发本地 rm → 文件堆积 → 磁盘更紧 → 下一段又失败,
正反馈把磁盘吃完。
把两处 ? 改成 log + continue:
- segment_processor 失败:跳过当前段,下个事件继续
- upload_single_file 失败:跳过,已上传的段照常进入 uploaded.{videos,paths}
直播会话结束(channel close)时,submit_to_bilibili 仍然能用收集到
的 videos 提交,execute_postprocessor 仍能 rm 已成功的本地文件。
修复对应残留 1.6 TB 历史文件的根因(35 次/5 天 "Process segment
event failed: ffmpeg remux failed ... No space left on device")。
* test(hook): remux 在 ffmpeg 失败时返回 Err(供 pipeline 容错前置条件)
复现 pipeline_upload_videos 容错路径的触发条件:segment_processor
(Remux step) 在 ffmpeg 退非 0 时返回 Err。生产事故的具体表现就是磁盘
满让 ffmpeg 写 mp4 header 失败,调用方必须能从该 Err 优雅恢复
(log + continue),否则整批已上传的段都拿不到 postprocessor 的 rm。
完整 pipeline_upload_videos 的端到端测试要 mock UploadContext
(BiliBili client + 登录态),这是后续重构 seam 的方向。
🛠️ 功能
- 开箱即用,多种安装方式,提供可视化WebUi界面
- 多主播录制/上传,24X7无人值守运行,高自定义元信息
- 边录边传不落盘急速上传,节省本地硬盘空间
论坛:BBS
📜 更新日志
Important
Disclaimer / 免责声明
- 本项目仅供个人学习研究,不保证稳定性,不提供技术支持
- 使用本项目产生的一切后果由用户自行承担
- 禁止商业用途,请遵守版权及平台规定
- This project is for personal learning and research purposes only
- No stability guarantee or technical support provided
- Users are solely responsible for any consequences of using this project
- Commercial use is strictly prohibited
- Please respect copyright and platform ToS
📜 使用文档
B 站命令行投稿工具,支持短信登录、账号密码登录、扫码登录、浏览器登录以及网页Cookie登录,并将登录后返回的 cookie 和 token 保存在 cookie.json 中,可用于其他项目。
- 下载 Release: biliupR
- 获取命令帮助
biliup --help
文档地址:https://biliup.github.io/biliup-rs
Upload video to bilibili.
Usage: biliup [OPTIONS] <COMMAND>
Commands:
login 登录B站并保存登录信息
renew 手动验证并刷新登录信息
upload 上传视频
append 是否要对某稿件追加视频
show 打印视频详情
dump-flv 输出flv元数据
download 下载视频
server 启动web服务,默认端口19159
list 列出所有已上传的视频
help Print this message or the help of the given subcommand(s)
Options:
-p, --proxy <PROXY> 配置代理
-u, --user-cookie <USER_COOKIE> 登录信息文件 [default: cookies.json]
--rust-log <RUST_LOG> [default: tower_http=debug,info]
-h, --help Print help
-V, --version Print version
启动录制服务
启动web服务,默认端口19159
Usage: biliup server [OPTIONS]
Options:
-b, --bind <BIND> Specify bind address [default: 0.0.0.0]
-p, --port <PORT> Port to use [default: 19159]
--auth 开启登录密码认证
-h, --help Print help
🚀 快速开始
Windows
- 下载 Release: bbup-app_0.1.0_x64
Linux 或 macOS
- 安装 uv
- 安装:
uv tool install biliup - 启动:
biliup server --auth - 访问 WebUI:
http://your-ip:19159
- 后台运行
nohup biliup server --auth &- 请查看参考
Termux
- 详见Wiki
🧑💻开发
架构概览
Rust后端 + Python引擎 + Next.js前端的混合架构。
graph TB
subgraph "🌐 前端层"
UI[Next.js Web界面<br/>React + TypeScript<br/>Semi UI组件库]
end
subgraph "⚡ Rust后端服务"
CLI[Web API服务器<br/>biliup-cli<br/>用户认证 & REST API]
CORE[核心上传库<br/>biliup<br/>Bilibili API客户端]
GEARS[Python绑定<br/>stream-gears<br/>性能优化桥接]
end
subgraph "🐍 Python引擎"
ENGINE[下载引擎<br/>biliup<br/>任务调度 & 流处理]
PLUGINS[插件系统<br/>20+平台支持<br/>斗鱼/虎牙/Twitch等]
DANMAKU[弹幕系统<br/>实时弹幕获取<br/>多平台协议支持]
end
subgraph "🗄️ 数据层"
DB[(SQLite数据库<br/>配置存储<br/>任务状态 & 日志)]
FILES[文件系统<br/>临时视频存储<br/>缓存管理]
end
subgraph "🌍 外部服务"
BILI[Bilibili API<br/>视频上传服务]
STREAMS[直播平台<br/>斗鱼/虎牙/B站等<br/>实时流媒体]
end
UI --> CLI
CLI --> CORE
CLI --> ENGINE
CLI --> DB
GEARS --> ENGINE
ENGINE --> PLUGINS
ENGINE --> DANMAKU
ENGINE --> FILES
CORE --> BILI
PLUGINS --> STREAMS
DANMAKU --> STREAMS
style UI fill:#e1f5fe
style CLI fill:#f3e5f5
style CORE fill:#f3e5f5
style GEARS fill:#f3e5f5
style ENGINE fill:#e8f5e8
style PLUGINS fill:#e8f5e8
style DANMAKU fill:#e8f5e8
style DB fill:#fff3e0
style FILES fill:#fff3e0
style BILI fill:#ffebee
style STREAMS fill:#ffebee
frontend
- 确保 Node.js 版本 ≥ 18
- 安装依赖:
npm i - 启动开发服务器:
npm run dev - 访问:
http://localhost:3000
Python
- 安装依赖
maturin dev npm run build- 启动 Biliup:
python3 -m biliup
Rust-cli
npm run build- 构建
cargo build --release --bin biliup - 开发启动 BiliupR:
cargo run
🤝Credits
- Thanks
ykdl, youtube-dl, streamlinkprovides downloader. - Thanks
THMonster/danmaku.
💴捐赠
⭐Stars
Description
自动直播录制、投稿、twitch、ytb频道搬运工具。命令行投稿(B站)和视频下载工具,提供多种登录方式,支持多p。边录边传0落盘
https://biliup.github.io/biliup/
6.7 MiB
0 Stars
1 Watchers
0 Forks
Languages
Rust
75.6%
TypeScript
16.6%
Python
4.8%
SCSS
2%
JavaScript
0.4%
Other
0.5%
