LoadConfig ,无GPU兼容

This commit is contained in:
Jerry Yan 2022-04-15 17:05:22 +08:00
parent 1ec065428d
commit 7eb32d4ce1
2 changed files with 4 additions and 1 deletions

View File

@ -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="弹幕标准")

View File

@ -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",