You've already forked my-video-workflow
还是使用DanmakuFactory
Revert "换用danmu2ass"
This reverts commit 4c3d74fed8
.
This commit is contained in:
@ -7,7 +7,7 @@ from typing import Union
|
||||
|
||||
from bs4 import BeautifulSoup
|
||||
|
||||
from config import DANMU_ASS_EXEC, VIDEO_RESOLUTION, DANMAKU_SPEED, DEFAULT_FONT_NAME
|
||||
from config import DANMAKU_FACTORY_EXEC, VIDEO_RESOLUTION, DANMAKU_SPEED, DEFAULT_FONT_NAME
|
||||
from exception.danmaku import NoDanmakuException, DanmakuFormatErrorException
|
||||
from util.file import check_file_exist
|
||||
|
||||
@ -34,11 +34,12 @@ def diff_danmaku_files(base_file: Union[os.PathLike[str], str], file: Union[os.P
|
||||
|
||||
def danmaku_to_subtitle(file: Union[os.PathLike[str], str], time_shift: float):
|
||||
new_subtitle_name = md5(file.encode("utf-8")).hexdigest() + ".ass"
|
||||
(_w, _h) = VIDEO_RESOLUTION.split("x")
|
||||
process = subprocess.Popen((
|
||||
DANMU_ASS_EXEC, "--force", "-a", "0.9", "-d", str(DANMAKU_SPEED), "--font", str(DEFAULT_FONT_NAME),
|
||||
"--font-size", "40", "--lane-size", "40", "--width", _w, "--height", _h, "-o", new_subtitle_name,
|
||||
"-p", "1", "--time-offset", str(time_shift), "--width-ratio", "1", file
|
||||
DANMAKU_FACTORY_EXEC, "--ignore-warnings",
|
||||
"-r", str(VIDEO_RESOLUTION), "-s", str(DANMAKU_SPEED), "-f", "5",
|
||||
"-S", "40", "-N", str(DEFAULT_FONT_NAME), "--showmsgbox", "FALSE",
|
||||
"-O", "255", "-L", "1", "-D", "0",
|
||||
"-o", "ass", new_subtitle_name, "-i", file, "-t", str(time_shift)
|
||||
))
|
||||
process.wait()
|
||||
return new_subtitle_name
|
||||
|
Reference in New Issue
Block a user