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
2 changes: 2 additions & 0 deletions docs/biliup.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# biliup常见问题

> 如果没有找到遇到的问题,请及时在 [issues](https://github.com/timerring/bilive/issues/new/choose) 中提出。

## biliup-rs 产生的 cookies 用处是什么?
1. 主要用于上传前验证登录状态。
2. 投稿时(包括追加投稿时)指定账号。
Expand Down
2 changes: 2 additions & 0 deletions docs/install-questions.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# 安装常见问题

> 如果没有找到遇到的问题,请及时在 [issues](https://github.com/timerring/bilive/issues/new/choose) 中提出。

## OSError: sndfile library not found

Reference: https://github.com/timerring/bilive/issues/106
Expand Down
2 changes: 2 additions & 0 deletions docs/record.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# record 常见问题

> 如果没有找到遇到的问题,请及时在 [issues](https://github.com/timerring/bilive/issues/new/choose) 中提出。

## 录制 cookies 用处是什么

主要用于录制时验证账号,B 站默认未登录状态下最高画质参数为 250 (超清),如果想要录制更高参数的画质视频,需要登录账号,请在配置文件中指定账号的 cookies。
Expand Down
8 changes: 7 additions & 1 deletion docs/scan.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# scan 常见问题

> 如果没有找到遇到的问题,请及时在 [issues](https://github.com/timerring/bilive/issues/new/choose) 中提出。

## 关于渲染速率

渲染速率主要与硬件以及弹幕数量有关,测试硬件的基本区间 2核 Xeon(R) Platinum 85 的 CPU 的渲染速率在 3 ~ 6 倍之间,也可使用 Nvidia GPU 加速,项目的测试显卡为 GTX1650,其渲染速率在 16 ~ 20 倍之间。
Expand Down Expand Up @@ -29,4 +31,8 @@ Glyph 0x... not found, selecting one more font for (Microsoft YaHei, 400, 0)
```
Reference:https://github.com/timerring/bilive/issues/35

解决方案:通常 ffmpeg 无法渲染表情,因此很多情况下关于表情的渲染都会报错,我已经通过一个通用正则滤除了 99% 的表情,当然可能会有其他奇怪的表情和字符,如果报错忽略即可,ffmpeg 会渲染为一个方框,不影响效果。
解决方案:通常 ffmpeg 无法渲染表情,因此很多情况下关于表情的渲染都会报错,我已经通过一个通用正则滤除了 99% 的表情,当然可能会有其他奇怪的表情和字符,如果报错忽略即可,ffmpeg 会渲染为一个方框,不影响效果。

## 为什么又改回队列的方式渲染弹幕了

由于通常 nvidia 加速下的弹幕渲染速率为 10 ~ 15x,而 whisper 执行语音识别的速率为 5x,因此之前由 whisper 创建弹幕渲染的方式是完全行得通的,但是对于弹幕非常多的直播间来说(20分钟片段产生15400+条弹幕),渲染速率会下降到 2 ~ 4x,当新一轮 whisper 处理后的片段进行弹幕渲染时,会进一步使渲染速率下降,堆积超过 3 个并行的弹幕渲染进程,会由于显卡并发编码的数量限制而导致失败,此外还会存在爆显存的风险。因此,为了保证渲染的质量和程序的稳定性,我原改回列队的方式处理弹幕渲染。
2 changes: 2 additions & 0 deletions docs/upload.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# upload 常见问题

> 如果没有找到遇到的问题,请及时在 [issues](https://github.com/timerring/bilive/issues/new/choose) 中提出。

## 上传默认参数

上传默认参数如下,[]中内容全部自动替换:
Expand Down
21 changes: 16 additions & 5 deletions src/burn/only_render.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@
from src.burn.generate_danmakus import get_resolution, process_danmakus
from src.burn.generate_subtitles import generate_subtitles
from src.burn.render_video import render_video
import multiprocessing
import queue
import threading
import time

render_queue = queue.Queue()

def normalize_video_path(filepath):
"""Normalize the video path to upload
Expand Down Expand Up @@ -44,8 +48,7 @@ def render_video_only(video_path):

# # Delete relative files
for remove_path in [original_video_path, xml_path, ass_path, srt_path, jsonl_path]:
if os.path.exists(remove_path):
os.remove(remove_path)
os.remove(remove_path)

# # For test
# test_path = original_video_path[:-4]
Expand All @@ -54,10 +57,18 @@ def render_video_only(video_path):
with open(f"{SRC_DIR}/upload/uploadVideoQueue.txt", "a") as file:
file.write(f"{format_video_path}\n")

def monitor_queue():
while True:
if not render_queue.empty():
video_path = render_queue.get()
render_video_only(video_path)
else:
print("No video to render, waiting 1 secondfor new video...", flush=True)
time.sleep(1)

def pipeline_render(video_path):
generate_subtitles(video_path)
burn_process = multiprocessing.Process(target=render_video_only, args=(video_path,))
burn_process.start()
render_queue.put(video_path)

if __name__ == '__main__':
# Read and define variables
Expand Down
5 changes: 4 additions & 1 deletion src/burn/scan.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

import os
from pathlib import Path
from src.burn.only_render import render_video_only, pipeline_render
from src.burn.only_render import render_video_only, pipeline_render, monitor_queue
from src.burn.render_and_merge import render_and_merge
import time
from src.allconfig import VIDEOS_DIR, MODEL_TYPE
import threading

def process_folder_merge(folder_path):
# Don't process the recording folder
Expand Down Expand Up @@ -49,6 +50,8 @@ def process_folder_append(folder_path):

if __name__ == "__main__":
room_folder_path = VIDEOS_DIR
monitor_thread = threading.Thread(target=monitor_queue, daemon=True)
monitor_thread.start()
while True:
for room_folder in Path(room_folder_path).iterdir():
if room_folder.is_dir():
Expand Down