diff --git a/cli_d_wf.py b/cli_d_wf.py index 7967326..d0946c5 100644 --- a/cli_d_wf.py +++ b/cli_d_wf.py @@ -1,8 +1,10 @@ import argparse +from config import load_config from worker.danmaku import do_workflow if __name__ == '__main__': + load_config() parser = argparse.ArgumentParser() parser.add_argument("video", help="视频标准") parser.add_argument("base", help="弹幕标准") diff --git a/workflow/video.py b/workflow/video.py index 6f0770a..1b1c489 100644 --- a/workflow/video.py +++ b/workflow/video.py @@ -23,7 +23,8 @@ def get_video_real_duration(filename): def encode_video_with_subtitles(orig_filename: str, subtitles: list[str], new_filename: str): encode_process = subprocess.Popen([ FFMPEG_EXEC, "-hide_banner", "-progress", "-", "-v", "0", "-y", - "-i", orig_filename, "-vf", ",".join("subtitles=%s" % i for i in subtitles) + ",hwupload_cuda", + "-i", orig_filename, "-vf", + ",".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", "hq",