zhangyong 1 年間 前
コミット
8a9b981e76
1 ファイル変更9 行追加6 行削除
  1. 9 6
      video_agc/agc_video_method.py

+ 9 - 6
video_agc/agc_video_method.py

@@ -217,7 +217,8 @@ class AgcVidoe():
         current_time = datetime.now()
         formatted_time = current_time.strftime("%Y-%m-%d")
         for j in video_files:
-            insert_sql = f"""INSERT INTO agc_video_deposit (audio, video_id, account_id, oss_object_key, time, platform, mark) values ('{uid}', '{j[0]}', '{j[1]}', '{j[2]}', '{formatted_time}', {platform}, {mark})"""
+            insert_sql = f"""INSERT INTO agc_video_deposit (audio, video_id, account_id, oss_object_key, time, platform, mark) values ('{uid}', '{j[0]}', '{j[1]}', '{j[2]}', '{formatted_time}', '{platform}', '{mark}')"""
+            print("insert_sql")
             MysqlHelper.update_values(
                 sql=insert_sql,
                 env="prod",
@@ -242,9 +243,9 @@ class AgcVidoe():
             # subtitle_cmd = f"subtitles={s_path}:force_style='Fontsize=11,Fontname=Hiragino Sans GB,Outline=0,PrimaryColour=&H000000,SecondaryColour=&H000000'"
             subtitle_cmd = f"subtitles={s_path}:force_style='Fontsize=11,Fontname=wqy-zenhei,Outline=0,PrimaryColour=&H000000,SecondaryColour=&H000000'"
         else:
-            subtitle_cmd = "drawtext=text='分享、转发给群友':fontsize=50:fontcolor=black:x=(w-text_w)/2:y=h-text_h-50"
+            subtitle_cmd = "drawtext=text='分享、转发给群友':fontsize=50:fontcolor=black:x=(w-text_w)/2:y=h-text_h-30"
         # 背景色参数
-        background_cmd = "drawbox=y=ih-158:color=yellow@1.0:width=iw:height=0:t=fill"
+        background_cmd = "drawbox=y=ih-118:color=yellow@1.0:width=iw:height=0:t=fill"
         # 分辨率参数
         resolution_cmd = "-s", "480x854"
         # 多线程数
@@ -259,12 +260,14 @@ class AgcVidoe():
             "-c:v", "libx264",
             "-c:a", "aac",
             "-threads", str(num_threads),
-            "-vf", f"{background_cmd},{subtitle_cmd}",  # 添加背景色和字幕
+            *resolution_cmd,  # 添加分辨率参数
+            "-vf", f"scale=480:854{background_cmd},{subtitle_cmd}",  # 添加背景色和字幕
+            "-preset", "medium",  # 添加 x264 编码器的预设
+            "-profile:v", "main",  # 指定视频编码的配置文件
             "-b:v", "9997K",
             "-shortest",  # 保持与音频时长一致
             "-map", "0:v:0",  # 映射第一个输入的视频流
             "-map", "1:a:0",  # 映射第二个输入的音频流
-            *resolution_cmd,  # 添加分辨率参数
             "-y",  # 覆盖输出文件
             v_path
         ]
@@ -308,7 +311,7 @@ class AgcVidoe():
                     link = result[1][0]
                     limit_count = 1
                     if kb_count >= count or kb_count == 0:
-                        Feishu.bot('recommend', 'AGC完成通知', '今日视频拼接完成', mark)
+                        Feishu.bot('recommend', 'AGC完成通知', '今日自制视频拼接任务完成啦~', mark)
                         return mark
                 # 获取音频类型+字幕+标题
                 uid, srt, title_list = Material.get_all_data(feishu_id, link, mark)