Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

> 如果您觉得项目不错,欢迎 :star: 也欢迎 PR 合作,如果有任何疑问,欢迎提 issue 交流。
>
> 敬告:本项目仅供学习交流使用,请在征得对方许可的情况下录制,请勿未经授权私自将内容用于商业用途,请勿用于大规模录制,违者会被官方封禁,法律后果自负。
> **敬告:本项目仅供学习交流使用,请在征得对方许可的情况下录制,请勿未经授权私自将内容用于商业用途,请勿用于大规模录制,违者会被官方封禁,法律后果自负。**

自动监听并录制B站直播和弹幕(含付费留言、礼物等),根据分辨率转换弹幕、语音识别字幕并渲染进视频,根据弹幕密度切分精彩片段并通过视频理解大模型生成有趣的标题,根据图像生成模型自动生成视频封面,自动投稿视频和切片至B站,兼容无GPU版本,兼容超低配置服务器与主机。

Expand Down Expand Up @@ -79,11 +79,11 @@
|--------|---------|---------|---------|
| OS | Ubuntu 22.04.4 LTS | debian 6.1.0 | Ubuntu 22.04.4 LTS |
| Architecture | x64 | aarch64 | x64 |
| CPU | 2-core Intel(R) Xeon(R) Platinum 85 | 1-core Neoverse-N1 | Intel(R) Core(TM) i5-9300H CPU |
| CPU | 2-core Intel(R) Xeon(R) Platinum 85 | 1-core Neoverse-N1 | 8-core Intel(R) Core(TM) i5-9300H CPU |
| GPU | None | None | Nvidia GeForce GTX 1650 |
| Memory | 2G | 4G | 24G |
| Disk | 40G | 30G | 512G |
| Bandwidth | 3Mbps | 100Mbps | 100Mbps |
| Disk | 40G | 30G | 100G |
| Bandwidth | 3Mbps | 100Mbps | 50Mbps |
| Python Version | 3.10 | 3.10 | 3.10 |

> 个人经验:若想尽可能快地更新视频,主要取决于上传速度而非渲染速度,因此建议网络带宽越大越好。由于 [aarch64 版本 PyPI 没有 release](https://github.com/triton-lang/triton/issues/5561) 的 [triton 库](https://pypi.org/project/triton/#history),因此 aarch64 版本暂时不支持本地部署 whisper,pip 时请自行注释 requirement 中的 triton 环境,配置均测试可用。
Expand All @@ -105,7 +105,7 @@
![](https://cdn.jsdelivr.net/gh/timerring/scratchpad2023/2024/2024-12-11-19-08-58.png)

> [!IMPORTANT]
> 凡是用到 GPU 均需保证 GPU 显存大于运行程序所需 VRAM,具体计算 VRAM 方法可以参考[该部分](https://timerring.github.io/bilive/models.html#计算-vram-需求)。
> 凡是用到 GPU 均需保证 GPU 显存大于运行程序所需 VRAM,具体计算 VRAM 方法可以参考[该部分](https://timerring.github.io/bilive/models.html#calculate-vram-requirements)。

### Installation

Expand Down Expand Up @@ -161,7 +161,7 @@ pip install -r requirements.txt
> + 请保证 NVIDIA 显卡驱动安装正确 `nvidia-smi` `nvcc -V`,并能够调用 CUDA 核心 `print(torch.cuda.is_available())` 返回 `True`。如果未配置显卡驱动或未安装 `CUDA`,即使有 GPU 也无法使用,而会使用 CPU 推理,非常消耗 CPU 计算资源,不推荐,如果 CPU 硬件条件好可以尝试。
> + 使用该参数模型至少需要保证有显存大于 2.7GB 的 GPU,否则请使用其他参数量的模型。
> + 更多模型请参考 [whisper 参数模型](https://timerring.github.io/bilive/models.html) 部分。
> + 更换模型方法请参考 [更换模型方法](https://timerring.github.io/bilive/models.html#更换模型方法) 部分。
> + 更换模型方法请参考 [更换模型方法](https://timerring.github.io/bilive/models.html#change-model-method) 部分。

##### 2.2 MLLM 模型(自动切片功能)

Expand Down
1 change: 0 additions & 1 deletion docs/.vitepress/config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ let config = defineConfig({
{ text: 'Installation & Usage', link: '/installation' },
{ text: 'Models', link: '/models' },
{ text: 'Questions', link: '/install-questions' },
{ text: 'Biliup', link: '/biliup' },
{ text: 'Record', link: '/record' },
{ text: 'Upload', link: '/upload' },
{ text: 'Scan', link: '/scan' },
Expand Down
11 changes: 0 additions & 11 deletions docs/biliup.md

This file was deleted.

73 changes: 32 additions & 41 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
@@ -1,47 +1,38 @@

# Introduction

自动监听并录制B站直播和弹幕(含付费留言、礼物等),根据分辨率转换弹幕、语音识别字幕并渲染进视频,根据弹幕密度切分精彩片段并通过视频理解大模型生成有趣的标题,自动投稿视频和切片至B站,兼容无GPU版本,兼容超低配置服务器与主机。
> **Warning: This project is only for learning and exchange, please record after obtaining the consent of the other party, please do not use the content without authorization for commercial purposes, please do not use it for large-scale recording, otherwise it will be banned by the official, legal consequences will be self-borne.**

## Major features

- **速度快**:采用 `pipeline` 流水线处理视频,理想情况下录播与直播相差半小时以内,没下播就能上线录播,**目前已知 b 站录播最快版本**!
- **多房间**:同时录制多个直播间内容视频以及弹幕文件(包含普通弹幕,付费弹幕以及礼物上舰等信息)。
- **占用小**:自动删除本地已上传的视频,极致节省空间。
- **模版化**:无需复杂配置,开箱即用,( :tada: NEW)通过 b 站搜索建议接口自动抓取相关热门标签。
- **检测片段并合并**:对于网络问题或者直播连线导致的视频流分段,能够自动检测合并成为完整视频。
- **自动渲染弹幕**:自动转换xml为ass弹幕文件并且渲染到视频中形成**有弹幕版视频**并自动上传。
- **硬件要求极低**:无需GPU,只需最基础的单核CPU搭配最低的运存即可完成录制,弹幕渲染,上传等等全部过程,无最低配置要求,10年前的电脑或服务器依然可以使用!
- **( :tada: NEW)自动渲染字幕**(如需使用本功能,则需保证有 Nvidia 显卡):采用 OpenAI 的开源模型 [`whisper`](https://github.com/openai/whisper),自动识别视频内语音并转换为字幕渲染至视频中。
- **( :tada: NEW)自动切片上传**:根据弹幕密度计算寻找高能片段并切片,结合多模态视频理解大模型 [`GLM-4V-PLUS`](https://bigmodel.cn/dev/api/normal-model/glm-4) 自动生成有意思的切片标题及内容,并且自动上传。


## Architecture diagram
Automatically monitors and records Bilibili live broadcasts and danmaku (including paid comments, gifts, etc.), converts danmaku according to resolution, recognizes speech and renders subtitles into videos, splits exciting fragments according to danmaku density, and generates interesting titles through video understanding models, automatically generates video covers using image generation models, and automatically posts videos and slices to Bilibili, compatible with the version without GPU, compatible with low-configuration servers and hosts.

项目架构流程如下:

```mermaid
graph TD
User((用户))--record-->startRecord(启动录制)
startRecord(启动录制)--保存视频和字幕文件-->videoFolder[(Video 文件夹)]

User((用户))--scan-->startScan(启动扫描 Video 文件夹)
videoFolder[(Video 文件夹)]<--间隔两分钟扫描一次-->startScan(启动扫描 Video 文件夹)
startScan <--视频文件--> whisper[whisperASR模型]
whisper[whisperASR模型] --生成字幕-->parameter[查询视频分辨率]
subgraph 启动新进程
parameter[查询分辨率] -->ifDanmaku{判断}
ifDanmaku -->|有弹幕| DanmakuConvert[DanmakuConvert]
ifDanmaku -->|无弹幕| ffmpeg1[ffmpeg]
DanmakuConvert[DanmakuConvert] --根据分辨率转换弹幕--> ffmpeg1[ffmpeg]
ffmpeg1[ffmpeg] --渲染弹幕及字幕 --> Video[视频文件]
Video[视频文件] --计算弹幕密度并切片--> GLM[多模态视频理解模型]
GLM[多模态视频理解模型] --生成切片信息--> slice[视频切片]
end

slice[视频切片] --> uploadQueue[(上传队列)]
Video[视频文件] --> uploadQueue[(上传队列)]
## Major features

User((用户))--upload-->startUpload(启动视频上传进程)
startUpload(启动视频上传进程) <--扫描队列并上传视频--> uploadQueue[(上传队列)]
```
- **Fast**:Use the `pipeline` pipeline to process videos, in ideal conditions, the recording and live broadcast differ by half an hour, and the recording can be上线录播,**Currently the fastest version of Bilibili recording**!
- **( 🎉 NEW)Multi-architecture**:Compatible with amd64 and arm64 architectures!
- **Multiple rooms**:Simultaneously record the content of multiple live broadcast rooms and danmaku files (including normal danmaku, paid danmaku, and gift-up-ship information).
- **Small memory usage**:Automatically delete locally uploaded videos, saving space.
- **Template**:No complex configuration, ready to use, automatically fetch related popular tags through the Bilibili search suggestion interface.
- **Detect and merge segments**:For video stream segments caused by network issues or live broadcast connection issues, it can automatically detect and merge them into complete videos.
- **Automatically render danmaku**:Automatically convert xml to ass danmaku file, the danmaku conversion tool library has been open source [DanmakuConvert](https://github.com/timerring/DanmakuConvert) and rendered to the video to form **danmaku version video** and automatically upload.
- **Low hardware requirements**:No GPU required, only the most basic single-core CPU and the lowest memory can complete the recording, danmaku rendering, upload, etc. All processes, no minimum configuration requirements, 10-year-old computers or servers can still be used!
- **( :tada: NEW)Automatically render subtitles**:Use the OpenAI open source model `whisper`, automatically identify the speech in the video and convert it to subtitles, and render it to the video.
- **( :tada: NEW)Auto-slice upload**:Calculate the danmaku density and find the high-energy fragments, the auto-slice tool library has been open source [auto-slice-video](https://github.com/timerring/auto-slice-video), combine the multi-modal video understanding large model to automatically generate interesting slice titles and content, and automatically upload, currently supported models:
- `GLM-4V-PLUS`
- `Gemini-2.0-flash`
- `Qwen-2.5-72B-Instruct`
- **( :tada: NEW)Persistent login/download/upload video (supports multi-part posting)**:[bilitool](https://github.com/timerring/bilitool) has been open source, implements persistent login, download video and danmaku (including multi-part)/upload video (can post multi-part), query posting status, query detailed information, etc., one-click pip installation, can be operated using the command line cli, and can also be used as an api call.
- **( :tada: NEW)Auto-loop multi-platform live streaming**:The tool has been open source [looplive](https://github.com/timerring/looplive) is a 7 x 24 hours fully automatic **loop multi-platform live streaming** tool.
- **( :tada: NEW)Generate style-transformed video covers**:Use the image-to-image multi-modal model to automatically obtain the video screenshot and upload the style-transformed video cover.
- `Minimax image-01`
- `Kwai Kolors`
- `Tencent Hunyuan`
- `Baidu ERNIE irag-1.0`
- `Stable Diffusion 3.5 large turbo`
- `Luma Photon`
- `Ideogram V_2`
- `Recraft`
- `Amazon Titan Image Generator V2`

The project architecture process is as follows:

![](https://cdn.jsdelivr.net/gh/timerring/scratchpad2023/2024/2025-04-10-17-08-35.png)
38 changes: 19 additions & 19 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,31 @@ layout: home
hero:
name: "bilive"
text: "Official documentation"
tagline: 7 x 24 小时无人监守录制、渲染弹幕、识别字幕、自动切片、自动上传、兼容超低配机器,启动项目,人人都是录播员。
tagline: 7 x 24 hours unattended recording, rendering danmaku, recognizing subtitles, automatic slicing, automatic uploading, compatible with low-configuration machines, start the project, then everyone can be a recorder.
actions:
- theme: brand
text: 现在开始
text: Start now
link: /getting-started
- theme: alt
text: 在 GitHub 上查看
text: View on GitHub
link: https://github.com/timerring/bilive

features:
- title: 速度快
details: 采用 pipeline 流水线处理视频,理想情况下录播与直播相差半小时以内,没有下播前就上传录播!
- title: 占用小
details: 同时录制多个直播间直播以及弹幕(包含普通弹幕,付费弹幕以及礼物上舰等信息),极小的空间也能运行。
- title: 模版化
details: 无需复杂配置,开箱即用,(🎉NEW) 通过 b 站搜索建议接口自动抓取相关热门标签。
- title: (🎉NEW) 自动切片上传
details: 根据弹幕密度计算寻找高能片段并切片,结合多模态视频理解大模型 GLM-4V-PLUS 自动生成有意思的切片标题及内容,并且自动上传。
- title: 多模式
details: 除了 pipeline 模式,还支持 append 以及 merge 模式,对于网络问题或者直播连线导致的视频流分段,能够自动检测合并成为完整视频。
- title: fine tune 渲染弹幕
details: 自动转换 xml ass 弹幕文件并且渲染到视频中形成有弹幕版视频并自动上传。根据不同分辨率的视频有 fine tune 的渲染参数。
- title: 硬件要求低
details: 即使无 GPU ,只用最基础的单核 CPU 搭配最低的运存即可完成录制,弹幕渲染,上传等等全部过程,无最低配置要求,10 年前的电脑或服务器依然可以使用!
- title: (🎉NEW) 自动渲染字幕(需要Nvidia 显卡)
details: 采用 OpenAI 的开源模型 whisper ,自动识别视频内语音并转换为字幕渲染至视频中。
- title: Fast
details: Using pipeline to process videos, the recording and live broadcast difference is half an hour, and the recording can be uploaded before the broadcast ends!
- title: Small Occupancy
details: Simultaneously record multiple live broadcasts and danmaku (including normal danmaku, paid danmaku, and gift ship information), and run in a small space.
- title: Template
details: No complex configuration, ready to use, (🎉NEW) automatically fetch related popular tags through the bilibili search suggestion interface.
- title: (🎉NEW) Automatic slicing upload
details: Calculate the bullet density to find high-energy fragments and slice them, combine the multi-modal video understanding model GLM-4V-PLUS to automatically generate interesting slice titles and content, and upload them.
- title: Multi-mode
details: In addition to the pipeline mode, it also supports append and merge modes, and can automatically detect and merge video streams that are segmented due to network issues or live connection issues.
- title: Fine-tune rendering danmaku
details: Automatically convert xml to ass danmaku file and render it to the video to form a video with danmaku, and upload it automatically. There are fine-tune rendering parameters for different video resolutions.
- title: Low hardware requirements
details: Even without a GPU, you can complete the recording, danmaku rendering, and uploading process with the most basic single-core CPU and the lowest memory, and there is no minimum configuration requirement. 10-year-old computers or servers can still be used!
- title: (🎉NEW) Automatic rendering subtitles (requires Nvidia GPU)
details: Use the open-source model whisper from OpenAI to automatically recognize the audio in the video and convert it to subtitles and render it to the video.
---

28 changes: 10 additions & 18 deletions docs/install-questions.md
Original file line number Diff line number Diff line change
@@ -1,41 +1,33 @@
# 安装常见问题
# Installation common issues

> 如果没有找到遇到的问题,请及时在 [issues](https://github.com/timerring/bilive/issues/new/choose) 中提出。
> If you don't find the problem you encountered, please submit it in [issues](https://github.com/timerring/bilive/issues/new/choose).

## OSError: sndfile library not found

Reference: https://github.com/timerring/bilive/issues/106

解决方案:安装对应的库即可 `apt-get install libsndfile1`。

## Error /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34’ not found

Reference: https://blog.csdn.net/huazhang_001/article/details/128828999

尽量使用 22.04+ 的版本,更早版本的 ubuntu 自带 gcc 版本无法更新至 biliup-rs 所需版本。

解决方案:手动更新版本,参照链接操作即可。
Solution: Install the corresponding library `apt-get install libsndfile1`.

## requests.exceptions.ConnectionError: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))

https://stackoverflow.com/questions/70379603/python-script-is-failing-with-connection-aborted-connectionreseterror104

众所周知的网络环境原因
Known network environment reasons

解决方案:proxy
Solution: proxy.

## ERROR: Could not find a version that satisfies the requirement triton==3.1.0 (from versions: none) ERROR: No matching distribution found for triton==3.1.0

From [issue 168](https://github.com/timerring/bilive/issues/168)

根据 https://github.com/triton-lang/triton/issues/1057 确实可能存在这样的问题。
According to https://github.com/triton-lang/triton/issues/1057, there may be such a problem.

解决方案:我查 pypi 里已经更新了 triton 3.1.0 版本:https://pypi.org/project/triton/#history 可以考虑升级一下 pip,或者直接从 huggingface 上拉 whl 安装也没问题。测试机器版本 linux python3.10.12 pip 下是没问题的。
Solution: I checked that the pypi library has updated the triton 3.1.0 version: https://pypi.org/project/triton/#history, you can consider upgrading pip, or directly pull the whl installation from huggingface, it is not a problem. The test machine version is linux python3.10.12 pip, it is not a problem.

> 另外,triton 是一个推理的库,如果不需要用到 whisper 生成字幕的话,不装它也可以。
> Also, triton is a library for inference, if you don't need to use whisper to generate subtitles, you can also not install it.

## ModuleNotFoundError: No module named 'fcntl'

文件锁 `fcntl` 模块不支持 windows,有一些替代方式,但是最佳的解决方法就是使用 WSL 运行本项目。
The file lock `fcntl` module does not support windows, there are some alternative ways, but the best solution is to use WSL to run this project.

解决方案:使用 WSL 运行本项目。
Solution: Use WSL to run this project.
Loading