|
@@ -293,14 +293,13 @@ class FFmpeg():
|
|
|
subprocess.run(ffmpeg_cmd)
|
|
|
return concatenate_videos_url
|
|
|
|
|
|
-
|
|
|
"""
|
|
|
单个视频拼接
|
|
|
"""
|
|
|
@classmethod
|
|
|
- def single_video(cls, new_video_path, video_path_url):
|
|
|
+ def single_video(cls, new_video_path, video_path_url, zm):
|
|
|
single_video_url = video_path_url + 'single_video.mp4'
|
|
|
- # single_video_srt = video_path_url + 'single_video.srt'
|
|
|
+ single_video_srt = video_path_url + 'single_video.srt'
|
|
|
# 获取时长
|
|
|
duration = cls.get_video_duration(new_video_path)
|
|
|
start_time = cls.seconds_to_srt_time(0)
|
|
@@ -308,21 +307,15 @@ class FFmpeg():
|
|
|
single_video_txt = video_path_url + 'single_video.txt'
|
|
|
with open(single_video_txt, 'w') as f:
|
|
|
f.write(f"file '{new_video_path}'\n")
|
|
|
- # with open(single_video_srt, 'w') as f:
|
|
|
- # f.write(f"1\n{start_time} --> {end_time}\n\u2764\uFE0F{zm}\n\n")
|
|
|
- # width, height = cls.get_w_h_size(new_video_path)
|
|
|
height = 1080
|
|
|
box_height = int(int(height) / 4) # 框的高度为视频高度的四分之一
|
|
|
-
|
|
|
- background_cmd = f"drawbox=y=ih-{70 + box_height}-{int(box_height / 20)}:color=yellow@1.0:width=iw:height={box_height}:t=fill"
|
|
|
-
|
|
|
- # if video_share == '有':
|
|
|
- # # 添加字幕 wqy-zenhei Hiragino Sans GB
|
|
|
- # subtitle_cmd = f"subtitles={single_video_srt}:force_style='Fontsize=14,Fontname=wqy-zenhei,Outline=0,PrimaryColour=&H000000,SecondaryColour=&H000000,Bold=1,MarginV=20'"
|
|
|
- # draw = f"{background_cmd},{subtitle_cmd}"
|
|
|
- # else:
|
|
|
- subtitle_cmd = f"force_style='Fontsize=14,Fontname=wqy-zenhei,Outline=2,PrimaryColour=&H00FFFF,SecondaryColour=&H000000,Bold=1,MarginV=20'"
|
|
|
- # subtitle_cmd = f"subtitles={single_video_srt}:force_style='Fontsize=14,Fontname=wqy-zenhei,Outline=2,PrimaryColour=&H00FFFF,SecondaryColour=&H000000,Bold=1,MarginV=20'"
|
|
|
+ # background_cmd = f"drawbox=y=ih-{70 + box_height}-{int(box_height / 20)}:color=yellow@1.0:width=iw:height={box_height}:t=fill"
|
|
|
+ if zm:
|
|
|
+ with open(single_video_srt, 'w') as f:
|
|
|
+ f.write(f"1\n{start_time} --> {end_time}\n\u2764\uFE0F{zm}\n\n")
|
|
|
+ subtitle_cmd = f"subtitles={single_video_srt}:force_style='Fontsize=14,Fontname=wqy-zenhei,Outline=2,PrimaryColour=&H00FFFF,SecondaryColour=&H000000,Bold=1,MarginV=20'"
|
|
|
+ else:
|
|
|
+ subtitle_cmd = f"force_style='Fontsize=14,Fontname=wqy-zenhei,Outline=2,PrimaryColour=&H00FFFF,SecondaryColour=&H000000,Bold=1,MarginV=20'"
|
|
|
draw = f"{subtitle_cmd}"
|
|
|
# 多线程数
|
|
|
num_threads = 5
|