config加载,视频gpu参数兼容
This commit is contained in:
parent
f017210a71
commit
c1945779a8
@ -31,6 +31,7 @@ BILILIVE_RECORDER_DIRECTORY = "./"
|
|||||||
# xigua_dir
|
# xigua_dir
|
||||||
XIGUALIVE_RECORDER_DIRECTORY = "./"
|
XIGUALIVE_RECORDER_DIRECTORY = "./"
|
||||||
|
|
||||||
|
|
||||||
def load_config():
|
def load_config():
|
||||||
if not os.path.exists("config.ini"):
|
if not os.path.exists("config.ini"):
|
||||||
write_config()
|
write_config()
|
||||||
@ -103,3 +104,6 @@ def write_config():
|
|||||||
with open("config.ini", "w", encoding="utf-8") as f:
|
with open("config.ini", "w", encoding="utf-8") as f:
|
||||||
config.write(f)
|
config.write(f)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
load_config()
|
||||||
|
@ -17,7 +17,7 @@ def do_workflow(video_file, danmaku_base_file, *danmaku_files):
|
|||||||
result.append(danmaku_to_subtitle(danmaku_base_file, 0))
|
result.append(danmaku_to_subtitle(danmaku_base_file, 0))
|
||||||
for file in danmaku_files:
|
for file in danmaku_files:
|
||||||
try:
|
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:
|
except DanmakuException:
|
||||||
print("弹幕文件", file, "异常")
|
print("弹幕文件", file, "异常")
|
||||||
continue
|
continue
|
||||||
|
@ -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 ""),
|
",".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",
|
"-c:a", "copy", "-c:v", "h264_nvenc" if FFMPEG_USE_GPU else "h264", "-f", "mp4",
|
||||||
"-preset:v", "fast", "-profile:v", "high", "-level", "4.1",
|
"-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",
|
"-qmin", "10", "-qmax", "32", "-crf", "16",
|
||||||
# "-t", "10",
|
# "-t", "10",
|
||||||
new_filename
|
new_filename
|
||||||
|
Loading…
x
Reference in New Issue
Block a user