Skip to content

[BUG] 一些关于登录的问题 #123

Description

@lululutx

Describe the bug

(A clear and concise description of what the bug is.)

  1. 读取登录状态没有log?
  2. 我其实已经扫码登录并且生成cookies文件,但是依然无法录制超过高清以上的分辨率
    2.1 刚刚已经在录制原画了,可是重启项目又完蛋了,再重启也不行
  3. 希望分辨率能向下取整,即我选择4K,直播只有1080P,会按照1080P来录制.

P1:webui启动部分日志
image

P2:高清以上录制不动弹
image

P3:录制过程中的log
image

Activity

  1. timerring commented on Dec 10, 2024

    @timerring
    Owner

    好的了解,我建议直播流填写 250 即超清,因为没有 cookies 的话相当于未登录状态下录制,b 站设置未登录状态最高只有超清。有些直播间只能识别抓不到超清的流的话只能用默认的原画流。如果想录制超清以上画质的话,需要在 blrec 里再添加 cookies,我项目里的 cookies 只是用来自动验证状态并投稿,blrec 的 cookies 可以打开 blrec 面板(http://localhost:2233/settings) 在 cookies 一栏填写。
    image
    或者在 settings.toml 中填写

    [header]
    user_agent = "Mozilla/5.0 XXXXXXXXXXXX"
    cookie = ""
    

    具体获取方法可以参考 https://zmtblog.xdkd.ltd/2021/10/06/Get_bilibili_cookie/

    Note

    不填写 cookies 登录是一定抓取不到超清以上的流的。

  2. timerring commented on Dec 10, 2024

    @timerring
    Owner

    关于 2.1 这个重启需要等约半分钟,因为它添加房间并且验证启动弹幕服务器需要一点时间,可以尝试关闭该房间录制,再打开。

  3. timerring commented on Dec 10, 2024

    @timerring
    Owner

    关于 3,这个可以参考 blrec 的文档,我忘了有没有具体实现了😂,一般来说超清获取到直播流的可能性更大,其他画质或者原画都存在抓取不到流的可能。

  4. timerring commented on Dec 10, 2024

    @timerring
    Owner

    关于 1,读取登录状态没有log。这个 log 具体指什么 log 呢?blrec.log 录制的 log 吗,还是处理或者投稿的 log?
    项目我在本机和我另一台云服务上部署验证过,您应该是第一位在完全独立的环境中运行本项目朋友了,您的反馈对我非常重要,如果有任何疑问请一定及时提出。非常感谢!

  5. self-assigned this
    on Dec 10, 2024
  6. lululutx commented on Dec 10, 2024

    @lululutx
    Author

    关于 1,读取登录状态没有log。这个 log 具体指什么 log 呢?blrec.log 录制的 log 吗,还是处理或者投稿的 log? 项目我在本机和我另一台云服务上部署验证过,您应该是第一位在完全独立的环境中运行本项目朋友了,您的反馈对我非常重要,如果有任何疑问请一定及时提出。非常感谢!

    没问题,我只是在尝试,我必须验证不是我自己的愚蠢而导致的问题,等我排查一下,才会有更加建设性的建议

  7. timerring commented on Dec 10, 2024

    @timerring
    Owner

    关于 1,读取登录状态没有log。这个 log 具体指什么 log 呢?blrec.log 录制的 log 吗,还是处理或者投稿的 log? 项目我在本机和我另一台云服务上部署验证过,您应该是第一位在完全独立的环境中运行本项目朋友了,您的反馈对我非常重要,如果有任何疑问请一定及时提出。非常感谢!

    没问题,我只是在尝试,我必须验证不是我自己的愚蠢而导致的问题,等我排查一下,才会有更加建设性的建议

    没事没事哈哈,有问题直接提就好,因为我也能根据这些问题修改 README 帮助更多使用的人,我会把大家 issue 的问题收集,为后面上线 gitpage 文档做准备。

  8. lululutx commented on Dec 10, 2024

    @lululutx
    Author

    好的了解,我建议直播流填写 250 即超清,因为没有 cookies 的话相当于未登录状态下录制,b 站设置未登录状态最高只有超清。有些直播间只能识别抓不到超清的流的话只能用默认的原画流。如果想录制超清以上画质的话,需要在 blrec 里再添加 cookies,我项目里的 cookies 只是用来自动验证状态并投稿,blrec 的 cookies 可以打开 blrec 面板(http://localhost:2233/settings) 在 cookies 一栏填写。 image 或者在 settings.toml 中填写

    [header]
    user_agent = "Mozilla/5.0 XXXXXXXXXXXX"
    cookie = ""
    

    具体获取方法可以参考 https://zmtblog.xdkd.ltd/2021/10/06/Get_bilibili_cookie/。

    Note

    不填写 cookies 登录是一定抓取不到超清以上的流的。

    让我们一个一个来。我原先以为抓取高清的cookies是用的 bilirs的。
    现在有了新问题,无论我是在配置项setting.toml设置cookies,抑或是在webui输入cookies。再重启webui(./record.sh),项目都无法正常启动. 可能是b站的cookies格式变更过?

    • 已尝试过chrome和edge两个不同账号的cookies
    • 已尝试过更改user-agent

    附启动失败log两则(两篇log都是完整的)

    ./logs/blrec.log

    ` Gtk-Message: 22:51:12.539: Not loading module "atk-bridge": The functionality is provided by GTK natively. Please try to not load it.
    [5856, Main Thread] WARNING: GTK+ module /snap/firefox/4848/gnome-platform/usr/lib/gtk-2.0/modules/libcanberra-gtk-module.so cannot be loaded.
    GTK+ 2.x symbols detected. Using GTK+ 2.x and GTK+ 3 in the same process is not supported.: 'glib warning', file /build/firefox/parts/firefox/build/toolkit/xre/nsSigHandlers.cpp:187

    (firefox:5856): Gtk-WARNING **: 22:51:12.924: GTK+ module /snap/firefox/4848/gnome-platform/usr/lib/gtk-2.0/modules/libcanberra-gtk-module.so cannot be loaded.
    GTK+ 2.x symbols detected. Using GTK+ 2.x and GTK+ 3 in the same process is not supported.
    Gtk-Message: 22:51:12.924: Failed to load module "canberra-gtk-module"
    [5856, Main Thread] WARNING: GTK+ module /snap/firefox/4848/gnome-platform/usr/lib/gtk-2.0/modules/libcanberra-gtk-module.so cannot be loaded.
    GTK+ 2.x symbols detected. Using GTK+ 2.x and GTK+ 3 in the same process is not supported.: 'glib warning', file /build/firefox/parts/firefox/build/toolkit/xre/nsSigHandlers.cpp:187

    (firefox:5856): Gtk-WARNING **: 22:51:12.956: GTK+ module /snap/firefox/4848/gnome-platform/usr/lib/gtk-2.0/modules/libcanberra-gtk-module.so cannot be loaded.
    GTK+ 2.x symbols detected. Using GTK+ 2.x and GTK+ 3 in the same process is not supported.
    Gtk-Message: 22:51:12.956: Failed to load module "canberra-gtk-module"
    [2024-12-10 22:51:14,528] [INFO] [configure_logging] log file: /home/lulu/Projects/bilive/logs/blrecLog/blrec_2024-12-10-225114-527476.log `

    ./logs/blrecLog/blrec-xx-xx-xx.log

    [2024-12-10 22:51:14,528] [INFO] [configure_logging] log file: /home/lulu/Projects/bilive/logs/blrecLog/blrec_2024-12-10-225114-527476.log [2024-12-10 22:51:14,533] [DEBUG] [exception_handler] Enabled Exception Handler [2024-12-10 22:51:14,535] [DEBUG] [space_monitor] Enabled space monitor [2024-12-10 22:51:14,536] [DEBUG] [space_reclaimer] Enabled space reclaimer [2024-12-10 22:51:15,763] [DEBUG] [danmaku_client] [84074] Danmu info updated [2024-12-10 22:51:15,765] [DEBUG] [danmaku_client] [84074] Connecting to server... [2024-12-10 22:51:15,885] [DEBUG] [danmaku_client] [84074] Established WebSocket connection [2024-12-10 22:51:15,886] [DEBUG] [danmaku_client] [84074] Sent user authentication [2024-12-10 22:51:16,022] [DEBUG] [danmaku_client] [84074] Connecting to server... [2024-12-10 22:51:16,125] [DEBUG] [danmaku_client] [84074] Established WebSocket connection [2024-12-10 22:51:16,125] [DEBUG] [danmaku_client] [84074] Sent user authentication [2024-12-10 22:51:16,360] [DEBUG] [danmaku_client] [84074] Connecting to server... [2024-12-10 22:51:16,468] [DEBUG] [danmaku_client] [84074] Established WebSocket connection [2024-12-10 22:51:16,469] [DEBUG] [danmaku_client] [84074] Sent user authentication [2024-12-10 22:51:16,909] [DEBUG] [danmaku_client] [84074] Connecting to server... [2024-12-10 22:51:17,026] [DEBUG] [danmaku_client] [84074] Established WebSocket connection [2024-12-10 22:51:17,026] [DEBUG] [danmaku_client] [84074] Sent user authentication [2024-12-10 22:51:17,869] [DEBUG] [danmaku_client] [84074] Connecting to server... [2024-12-10 22:51:17,970] [DEBUG] [danmaku_client] [84074] Established WebSocket connection [2024-12-10 22:51:17,972] [DEBUG] [danmaku_client] [84074] Sent user authentication [2024-12-10 22:51:19,606] [DEBUG] [danmaku_client] [84074] Connecting to server... [2024-12-10 22:51:19,722] [DEBUG] [danmaku_client] [84074] Established WebSocket connection [2024-12-10 22:51:19,724] [DEBUG] [danmaku_client] [84074] Sent user authentication [2024-12-10 22:51:22,959] [DEBUG] [danmaku_client] [84074] Connecting to server... [2024-12-10 22:51:23,064] [DEBUG] [danmaku_client] [84074] Established WebSocket connection [2024-12-10 22:51:23,064] [DEBUG] [danmaku_client] [84074] Sent user authentication [2024-12-10 22:51:29,508] [DEBUG] [danmaku_client] [84074] Connecting to server... [2024-12-10 22:51:29,629] [DEBUG] [danmaku_client] [84074] Established WebSocket connection [2024-12-10 22:51:29,629] [DEBUG] [danmaku_client] [84074] Sent user authentication [2024-12-10 22:51:42,465] [DEBUG] [danmaku_client] [84074] Connecting to server... [2024-12-10 22:51:42,595] [DEBUG] [danmaku_client] [84074] Established WebSocket connection [2024-12-10 22:51:42,596] [DEBUG] [danmaku_client] [84074] Sent user authentication [2024-12-10 22:52:08,255] [DEBUG] [danmaku_client] [84074] Connecting to server... [2024-12-10 22:52:08,374] [DEBUG] [danmaku_client] [84074] Established WebSocket connection [2024-12-10 22:52:08,375] [DEBUG] [danmaku_client] [84074] Sent user authentication [2024-12-10 22:52:59,660] [DEBUG] [danmaku_client] [84074] Connecting to server... [2024-12-10 22:52:59,759] [DEBUG] [danmaku_client] [84074] Established WebSocket connection [2024-12-10 22:52:59,760] [DEBUG] [danmaku_client] [84074] Sent user authentication [2024-12-10 22:53:59,836] [DEBUG] [danmaku_client] [84074] Connecting to server... [2024-12-10 22:53:59,945] [DEBUG] [danmaku_client] [84074] Established WebSocket connection [2024-12-10 22:53:59,946] [DEBUG] [danmaku_client] [84074] Sent user authentication [2024-12-10 22:55:00,037] [DEBUG] [danmaku_client] [84074] Connecting to server... [2024-12-10 22:55:00,152] [DEBUG] [danmaku_client] [84074] Established WebSocket connection [2024-12-10 22:55:00,153] [DEBUG] [danmaku_client] [84074] Sent user authentication [2024-12-10 22:56:00,226] [DEBUG] [danmaku_client] [84074] Connecting to server... [2024-12-10 22:56:00,333] [DEBUG] [danmaku_client] [84074] Established WebSocket connection [2024-12-10 22:56:00,334] [DEBUG] [danmaku_client] [84074] Sent user authentication [2024-12-10 22:57:00,414] [DEBUG] [danmaku_client] [84074] Connecting to server... [2024-12-10 22:57:00,533] [DEBUG] [danmaku_client] [84074] Established WebSocket connection [2024-12-10 22:57:00,533] [DEBUG] [danmaku_client] [84074] Sent user authentication

  9. timerring commented on Dec 10, 2024

    @timerring
    Owner

    看 blrec.log 好像是缺少一个对应的库,可以参考 https://www.linuxquestions.org/questions/linux-software-2/gtk-message-failed-to-load-module-canberra-gtk-module-936168/page2.html 尝试装一下该库 sudo apt-get install libcanberra-gtk-module。

  10. timerring commented on Dec 10, 2024

    @timerring
    Owner

    看./logs/blrecLog/blrec-xx-xx-xx.log 一直验证 cookies 没有建立链接,还挺奇怪,不知道安装完库重启有没有效果。如果没有的话,其实我还是先推荐试一下没有 cookies 版本的 250 超清视频是否能够正常录制。因为 b 站官方容易风控有 cookies 的直播流获取,可能会存在完全无法录制的情况。不过要验证是否是本地环境冲突还是网络问题的最好办法还是先不用 cookies 重启随便超清录制一个看看能不能正常获取到直播流。目前我同时录制了十几个房间都没有遇到问题。

    无论我是在配置项setting.toml设置cookies,抑或是在webui输入cookies。再重启webui(./record.sh),项目都无法正常启动. 可能是b站的cookies格式变更过?

    这两个其实是一回事,settings 配置无法热修改,而 webui 配置可以热修改,不过也只针对修改之后添加的房间,统一起见还是 webui 修改以后,然后重启录制脚本应该是绝对没有问题的。b 站的 cookies 格式应该没有变化,都是buvid……开头的那个字符串,我半个月之前尝试 cookies 还能录制,不过也只有一些房间成功过。如果真的不放心的话,可以在 blrec 的 issue 里提一下。

  11. lululutx commented on Dec 10, 2024

    @lululutx
    Author

    看./logs/blrecLog/blrec-xx-xx-xx.log 一直验证 cookies 没有建立链接,还挺奇怪,不知道安装完库重启有没有效果。如果没有的话,其实我还是先推荐试一下没有 cookies 版本的 250 超清视频是否能够正常录制。因为 b 站官方容易风控有 cookies 的直播流获取,可能会存在完全无法录制的情况。不过要验证是否是本地环境冲突还是网络问题的最好办法还是先不用 cookies 重启随便超清录制一个看看能不能正常获取到直播流。目前我同时录制了十几个房间都没有遇到问题。

    无论我是在配置项setting.toml设置cookies,抑或是在webui输入cookies。再重启webui(./record.sh),项目都无法正常启动. 可能是b站的cookies格式变更过?

    这两个其实是一回事,settings 配置无法热修改,而 webui 配置可以热修改,不过也只针对修改之后添加的房间,统一起见还是 webui 修改以后,然后重启录制脚本应该是绝对没有问题的。b 站的 cookies 格式应该没有变化,都是buvid……开头的那个字符串,我半个月之前尝试 cookies 还能录制,不过也只有一些房间成功过。如果真的不放心的话,可以在 blrec 的 issue 里提一下。

    ok 我先尝试一下无cookies超清,加上压制弹幕加上传,大流程能不能走通.明早验证,早点休息

  12. timerring commented on Dec 10, 2024

    @timerring
    Owner

    好的,如果想尝试 pipeline 模式的话还是需要注意 GPU 的显存,一般渲染任务在 200MB 左右,whisper 的 asr 模型大概 small 显存在 2600 MB 左右,tiny 模型也在 1400 MB 左右,所以需要保证显卡显存至少大于渲染和 asr 所需的显存。当然如果不用 pipeline 模式的话,用其他模式都会 GPU_EXIST 如果为 true 都会执行 asr 语音识别的,也需要注意显存,GPU_EXIST 为 false 则完全不会使用 GPU,只会用 CPU 渲染弹幕,我设置的参数能保证一个非常快的压制速率,不过文件可能会稍大20%。

    此外,record 和 scan upload 是三个相对独立的过程,可以分别单独测试。时刻注意观察日志以及ps -ef | grep xxx获取对应线程的执行情况。

    明天如果遇到问题再实时反馈,非常感谢。

  13. lululutx commented on Dec 11, 2024

    @lululutx
    Author

    scan和upload执行后没有反应,视频附带的xml和josnl为空(没登录?)
    Video文件夹是有录制成功的视频的

    控制台:
    lulu@lulu-Ubuntu:~/Projects/bilive$ ./scan.sh success lulu@lulu-Ubuntu:~/Projects/bilive$ ./upload.sh kill: 用法: kill [-s 信号说明符 | -n 信号编号 | -信号说明符] pid | 任务说明符 ... 或 kill -l [信号说明符] success lulu@lulu-Ubuntu:~/Projects/bilive$ ps -ef | grep $(pgrep -f src.burn.scan) lulu 3914 811 0 10:15 pts/0 00:00:00 python -m src.burn.scan lulu 4016 2070 0 10:16 pts/0 00:00:00 grep --color=auto 3914 lulu@lulu-Ubuntu:~/Projects/bilive$ ps -ef | grep $(pgrep -f src.upload.upload) lulu 3920 811 0 10:15 pts/0 00:00:00 python -m src.upload.upload

    scanlog
    2024-12-11 10:15:05 There is no file recorded. Check again in 120 seconds. 2024-12-11 10:17:05 There is no file recorded. Check again in 120 seconds. 2024-12-11 10:19:05 There is no file recorded. Check again in 120 seconds. 2024-12-11 10:21:05 There is no file recorded. Check again in 120 seconds.

    uploadLog
    2024-12-11 10:15:09 Empty queue, wait 2 minutes and check again... wait for 20 seconds 2024-12-11 10:17:29 Empty queue, wait 2 minutes and check again... wait for 20 seconds

    再附Video路径图
    image

  14. timerring commented on Dec 11, 2024

    @timerring
    Owner

    在面板中选择视频录制完成后转 mp4,我是通过 mp4 进行处理的。
    image

    [postprocessing]
    remux_to_mp4 = true
    inject_extra_metadata = true
    delete_source = "auto"
    

    默认是开启的,您可能关上了,录制中的视频是 flv 状态。

  15. timerring commented on Dec 11, 2024

    @timerring
    Owner

    视频附带的xml和josnl为空

    这个倒跟登录没有关系,只跟房间是否有人发送弹幕有关,xml 是弹幕文件,包含上舰信息,礼物信息和 SC 信息,jsonl 是 raw 状态的信息文件,包含各种信息,例如几人观看过,房间被谁分享了等等信息,我写的逻辑只对 xml 做处理。

  16. lululutx commented on Dec 11, 2024

    @lululutx
    Author

    在面板中选择视频录制完成后转 mp4,我是通过 mp4 进行处理的。
    默认是开启的,您可能关上了,录制中的视频是 flv 状态。

    嗯~新虚拟机忘装ffmpeg了。

  17. lululutx commented on Dec 11, 2024

    @lululutx
    Author

    视频附带的xml和josnl为空

    这个倒跟登录没有关系,只跟房间是否有人发送弹幕有关,xml 是弹幕文件,包含上舰信息,礼物信息和 SC 信息,jsonl 是 raw 状态的信息文件,包含各种信息,例如几人观看过,房间被谁分享了等等信息,我写的逻辑只对 xml 做处理。

    但是这个主播观众人数特别多,xml不应该是空

  18. timerring commented on Dec 11, 2024

    @timerring
    Owner

    我知道问题在哪了,请填写超过 7 位数的 roomid,84074 是 b 站方便推广的一个短链接,用户跳转是直接映射到真实roomid 去的,真正的 roomid 是申请开播权限时分配的,应该是 7~9 位数字,想要找到真正的房间号可以在移动端分享里面图片分享方式分享直播,然后 b 站移动端会自动生成一个带有真正 roomid 的图片。比如说我查到这个房间的真正 roomid 是 14709735。

    弹幕服务器是无法通过短链接获取弹幕的。因为短链接只起到映射跳转作用。

  19. lululutx commented on Dec 11, 2024

    @lululutx
    Author

    好! 我再晚些时候再尝试一下

  20. timerring commented on Dec 12, 2024

    @timerring
    Owner

    我部署上线了相关文档,如果有任何问题,欢迎继续提,我补充在文档里。

  21. lululutx commented on Dec 12, 2024

    @lululutx
    Author

    好的,我正在弹幕合并 😊

  22. timerring commented on Dec 12, 2024

    @timerring
    Owner

    好的,为保证每个 issue 尽可能简洁并符合标题,方便后来人查看,我先关闭本 issue 了。
    如果遇到其他问题欢迎提新 issue。

  23. Repository owner locked and limited conversation to collaborators on May 1, 2025
  24. converted this issue into a discussion #310 on May 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

help wantedExtra attention is needed

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions