修改gop后切割,避免没切到keyframe

This commit is contained in:
2022-05-31 16:45:35 +08:00
parent 2d857752ca
commit 13f18c5e6c
2 changed files with 25 additions and 43 deletions

View File

@ -2,7 +2,7 @@ import os.path
from exception.danmaku import DanmakuException
from workflow.danmaku import get_file_start, diff_danmaku_files, danmaku_to_subtitle
from workflow.video import multi_gpu_encode_video_with_subtitles
from workflow.video import encode_video_with_subtitles, quick_split_video
def do_workflow(video_file, danmaku_base_file, *danmaku_files):
@ -26,9 +26,14 @@ def do_workflow(video_file, danmaku_base_file, *danmaku_files):
print("弹幕文件", danmaku_file, "异常")
continue
print(result)
multi_gpu_encode_video_with_subtitles(video_file, result, start_ts)
file_need_split = encode_video_with_subtitles(video_file, result, start_ts)
for file in file_need_split:
quick_split_video(file)
# clean files
for file in result:
if os.path.isfile(file):
os.remove(file)
for file in file_need_split:
if os.path.isfile(file):
os.remove(file)