|
@@ -302,7 +302,7 @@ class FFmpeg():
|
|
|
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)
|
|
|
+ start_time = cls.seconds_to_srt_time(5)
|
|
|
end_time = cls.seconds_to_srt_time(duration)
|
|
|
single_video_txt = video_path_url + 'single_video.txt'
|
|
|
with open(single_video_txt, 'w') as f:
|
|
@@ -312,10 +312,11 @@ class FFmpeg():
|
|
|
# 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'"
|
|
|
+ # f.write(f"1\n{start_time} --> {end_time}\n{zm}\n\n")
|
|
|
+ f.write(f"1\n{start_time} --> {end_time}\n<font color=\"red\">\u2764\uFE0F</font>{zm}\n\n")
|
|
|
+ subtitle_cmd = f"subtitles={single_video_srt}:force_style='Fontsize=12,Fontname=wqy-zenhei,Outline=2,PrimaryColour=&H00FFFF,SecondaryColour=&H000000,Bold=1,MarginV=10'"
|
|
|
else:
|
|
|
- subtitle_cmd = f"force_style='Fontsize=14,Fontname=wqy-zenhei,Outline=2,PrimaryColour=&H00FFFF,SecondaryColour=&H000000,Bold=1,MarginV=20'"
|
|
|
+ subtitle_cmd = f"force_style='Fontsize=12,Fontname=wqy-zenhei,Outline=2,PrimaryColour=&H00FFFF,SecondaryColour=&H000000,Bold=1,MarginV=10'"
|
|
|
draw = f"{subtitle_cmd}"
|
|
|
# 多线程数
|
|
|
num_threads = 5
|
|
@@ -339,5 +340,10 @@ class FFmpeg():
|
|
|
|
|
|
|
|
|
|
|
|
+if __name__ == '__main__':
|
|
|
+ new_video_path = '/Users/tzld/Desktop/video_rewriting/path/output1.mp4'
|
|
|
+ video_path_url = '/Users/tzld/Desktop/video_rewriting/path/'
|
|
|
+ zm = '温馨提示:下方按钮可分享到群'
|
|
|
+ FFmpeg.single_video(new_video_path, video_path_url, zm)
|
|
|
|
|
|
|