CLI版本BililiveRecorder非官方使用文档。
原文地址:https://lxnchan.cn/bilibili-Rec.html
概况
- 本文的CLI使用基于Linux(Ubuntu 20.04 LTS)操作系统,其他系统请酌情参考。
- 测试机没有显卡,是云服务器。
- 本文全部操作都在
root
模式下运行,实际生产环境中可能存在安全问题。避免此问题请用非root账户操作并在所有命令前加上sudo
(Ubuntu)。
说明
我不是官方人员,此文档并非官方文档,一切均来源于自己使用的经验。
有错误的话欢迎大家前来指正!
基础使用
选择CLI-linux
字样的且符合设备架构的直接下载即可。
将下载好的压缩包传送到服务器上,解压。
通过cd
进入主程序目录。
1 2 |
#添加执行权限 chmod +x BililiveRecorder.Cli |
确认程序可运行(完整)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
./BililiveRecorder.Cli --help #正常输出如下 BililiveRecorder.Cli A Stream Recorder For Bilibili Live Usage: BililiveRecorder.Cli [options] [command] Options: --version Show version information -?, -h, --help Show help and usage information Commands: r, run <path> Run BililiveRecorder in standard mode p, portable <output-path> <room-ids> Run BililiveRecorder in config-less mode configure <path> Interactively configure config.json tool Run Tools |
在目标路径载入配置文件,这里以/root/Recorder
为例,需要先创建对应文件夹。
1
|
./BililiveRecorder.Cli configure /root/Recorder
|
然后进入配置页
1 2 3 4 5 6 7 8 |
List rooms #列出已配置的房间号 > Add room #添加房间 Delete room #删除房间 Update room config #更新房间配置 Update global config #更新全局配置 Update JSON Schema #更新JSON结构 Exit and discard all changes #不保存退出 Save and Exit #保存退出 |
选择第二项添加房间
1 2 3 4 5 6 7 8 9 10 11 |
#在后面输入房间号(live.bilibili.com/后面的数字就是房间号),输入0取消 #https://live.bilibili.com/22333522 (type 0 to cancel) Roomid: 22333522 #开播时自动录制,输入y开启 Enable auto record? [y/n] (y): #添加完成 Room 22333522 added to config (type 0 to cancel) Roomid: #输入0回主界面 |
查看已添加的房间
1 2 3 4 5 6 7 |
╭──────────┬────────────╮ │ Roomid │ AutoRecord │ ├──────────┼────────────┤ │ 22333522 │ Enabled │ │ 4033043 │ Enabled │ ╰──────────┴────────────╯ > List rooms |
在主界面选择Save and Exit
即可。
此时就已经完成了基本的配置,可以开始运行了。
运行
在目标路径运行./BililiveRecorder.Cli r /root/Recorder
。
如果房间号列表里面没有开播的话则输出[房间号] 弹幕服务器已连接
,否则会输出“接收直播流”。
1 2 3 4 5 |
[17:23:14 INF] [22333522] 连接直播服务器 d1--cn-gotcha04.bilivideo.com 录制画质 10000 (原画) [17:23:14 INF] [22333522] 弹幕服务器已连接 [17:23:14 INF] [22333522] 开始接收直播流 [17:23:14 INF] [22333522] 新建录制文件 /root/Recorder/22333522-伊万_iiivan/录制-22333522-20211219-172314-451-主播@了你.flv [17:23:14 INF] [4033043] 弹幕服务器已连接 |
此时就开始录制了,退出的话就按两次Ctrl+C
。
创建系统服务
创建系统服务:vim /etc/systemd/system/brh.service
输入如下内容
1 2 3 4 5 6 7 |
[Unit] Description=Bililive Recorder System Services After=network.target [Service] ExecStart=./root/BililiveRecorder/linux-x64/BililiveRecorder.Cli r /root/Recorder [Install] WantedBy=multi-user.target |
然后可以用systemctl
控制该服务。
1 2 3 4 5 6 |
#开启服务 systemctl start brh.service #停止服务 systemctl stop brh.service #查看状态和部分日志 systemctl status brh.service |
进阶使用
参看软件设置 - 文档 - B站录播姬,对照里面的配置项设置就行。