浏览代码

去掉 片中文字

zhangyong 10 月之前
父节点
当前提交
4be6243ce4
共有 2 个文件被更改,包括 16 次插入13 次删除
  1. 6 5
      common/ffmpeg.py
  2. 10 8
      video_rewriting/video_processor.py

+ 6 - 5
common/ffmpeg.py

@@ -298,9 +298,9 @@ class FFmpeg():
     单个视频拼接
     """
     @classmethod
-    def single_video(cls, new_video_path, video_path_url, zm):
+    def single_video(cls, new_video_path, video_path_url):
         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,8 +308,8 @@ 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")
+        # 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)  # 框的高度为视频高度的四分之一
@@ -321,7 +321,8 @@ class FFmpeg():
         #     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"subtitles={single_video_srt}:force_style='Fontsize=14,Fontname=wqy-zenhei,Outline=2,PrimaryColour=&H00FFFF,SecondaryColour=&H000000,Bold=1,MarginV=20'"
+        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'"
         draw = f"{subtitle_cmd}"
         # 多线程数
         num_threads = 5

+ 10 - 8
video_rewriting/video_processor.py

@@ -83,10 +83,10 @@ class VideoProcessor:
         crop_total = task["crop_total"]
         gg_duration_total = task["gg_duration_total"]
         video_path_url = cls.create_folders(mark, str(task_mark))
-        zm = Material.get_pzsrt_data("summary", "500Oe0", video_share)
-        if not zm:
-            Feishu.bot(mark, '机器自动改造消息通知', f'{task_mark}任务下片中标示填写错误,请关注!!!!', name)
-            return
+        # zm = Material.get_pzsrt_data("summary", "500Oe0", video_share)
+        # if not zm:
+        #     Feishu.bot(mark, '机器自动改造消息通知', f'{task_mark}任务下片中标示填写错误,请关注!!!!', name)
+        #     return
         if ',' in channel_urls:
             channel_url_list = channel_urls.split(',')
         else:
@@ -122,10 +122,12 @@ class VideoProcessor:
                         continue
                     if new_video_path:
                         if video_ending and video_ending != 'None':
-                            new_video_path = cls.handle_video_ending(new_video_path, video_ending, old_title, pw_random_id, video_path_url, mark, task_mark, url, name, video_share, zm)
+                            new_video_path = cls.handle_video_ending(new_video_path, video_ending, old_title, pw_random_id, video_path_url, mark, task_mark, url, name, video_share)
                         else:
                             if video_share and video_share != 'None':
-                                new_video_path = FFmpeg.single_video(new_video_path, video_path_url, zm)
+                                # new_video_path = FFmpeg.single_video(new_video_path, video_path_url, zm)
+                                new_video_path = FFmpeg.single_video(new_video_path, video_path_url)
+
                         if not os.path.isfile(new_video_path):
                             Feishu.bot(mark, '机器自动改造消息通知', f'{task_mark}任务用户{url}下的视频{v_id},视频改造失败,请关注', name)
                             cls.remove_files(video_path_url)
@@ -276,7 +278,7 @@ class VideoProcessor:
             return new_video_path
 
     @classmethod
-    def handle_video_ending(cls, new_video_path, video_ending, old_title, pw_random_id, video_path_url, mark, task_mark, url, name, video_share, zm):
+    def handle_video_ending(cls, new_video_path, video_ending, old_title, pw_random_id, video_path_url, mark, task_mark, url, name, video_share):
         """
         处理视频片尾
         """
@@ -330,7 +332,7 @@ class VideoProcessor:
         Common.logger("log").info(f"{name}的{task_mark}下的视频{url},视频与片尾拼接成功")
         time.sleep(1)
         if video_share and video_share != 'None':
-            new_video_path = FFmpeg.single_video(video_path, video_path_url, zm)
+            new_video_path = FFmpeg.single_video(video_path, video_path_url)
         else:
             new_video_path = video_path
         return new_video_path