diff --git a/config.py b/config.py index 47c84ce..f8cd043 100644 --- a/config.py +++ b/config.py @@ -31,6 +31,7 @@ BILILIVE_RECORDER_DIRECTORY = "./" # xigua_dir XIGUALIVE_RECORDER_DIRECTORY = "./" + def load_config(): if not os.path.exists("config.ini"): write_config() @@ -103,3 +104,6 @@ def write_config(): with open("config.ini", "w", encoding="utf-8") as f: config.write(f) return True + + +load_config() diff --git a/worker/danmaku.py b/worker/danmaku.py index 218dd95..0ea8314 100644 --- a/worker/danmaku.py +++ b/worker/danmaku.py @@ -17,7 +17,7 @@ def do_workflow(video_file, danmaku_base_file, *danmaku_files): result.append(danmaku_to_subtitle(danmaku_base_file, 0)) for file in danmaku_files: try: - result.append(danmaku_to_subtitle(file, diff_danmaku_files(danmaku_base_file, file))) + result.append(danmaku_to_subtitle(file, diff_danmaku_files(file, danmaku_base_file))) except DanmakuException: print("弹幕文件", file, "异常") continue diff --git a/workflow/video.py b/workflow/video.py index 31bf445..e3efe4f 100644 --- a/workflow/video.py +++ b/workflow/video.py @@ -27,7 +27,7 @@ def encode_video_with_subtitles(orig_filename: str, subtitles: list[str], new_fi ",".join("subtitles=%s" % i for i in subtitles) + (",hwupload_cuda" if FFMPEG_USE_GPU else ""), "-c:a", "copy", "-c:v", "h264_nvenc" if FFMPEG_USE_GPU else "h264", "-f", "mp4", "-preset:v", "fast", "-profile:v", "high", "-level", "4.1", - "-b:v", VIDEO_BITRATE, "-rc:v", "vbr", "-tune:v", "hq", + "-b:v", VIDEO_BITRATE, "-rc:v", "vbr", *(["-tune:v", "hq"] if FFMPEG_USE_GPU else []), "-qmin", "10", "-qmax", "32", "-crf", "16", # "-t", "10", new_filename