|
@@ -295,7 +295,7 @@ class AgcVidoe():
|
|
# 分辨率参数
|
|
# 分辨率参数
|
|
resolution_cmd = "-s", "320x480"
|
|
resolution_cmd = "-s", "320x480"
|
|
# 多线程数
|
|
# 多线程数
|
|
- num_threads = 4
|
|
|
|
|
|
+ num_threads = 8
|
|
# 构建 FFmpeg 命令,生成视频
|
|
# 构建 FFmpeg 命令,生成视频
|
|
ffmpeg_cmd = [
|
|
ffmpeg_cmd = [
|
|
"ffmpeg",
|
|
"ffmpeg",
|
|
@@ -303,6 +303,13 @@ class AgcVidoe():
|
|
"-safe", "0",
|
|
"-safe", "0",
|
|
"-i", f"{t_path}", # 视频文件列表
|
|
"-i", f"{t_path}", # 视频文件列表
|
|
"-i", audio_video, # 音频文件
|
|
"-i", audio_video, # 音频文件
|
|
|
|
+ "-pix_fmt", "yuv420p",
|
|
|
|
+ "-movflags", "faststart",
|
|
|
|
+ "-keyint_min", str(23.97 * 2),
|
|
|
|
+ "-g", str(23.97 * 2),
|
|
|
|
+ "-sc_threshold", "0",
|
|
|
|
+ "-strict", "experimental",
|
|
|
|
+ "-threads", str(num_threads),
|
|
"-c:v", "libx264",
|
|
"-c:v", "libx264",
|
|
"-c:a", "aac",
|
|
"-c:a", "aac",
|
|
"-vf", f"scale=320x480,{background_cmd},{subtitle_cmd}", # 添加背景色和字幕
|
|
"-vf", f"scale=320x480,{background_cmd},{subtitle_cmd}", # 添加背景色和字幕
|
|
@@ -317,8 +324,6 @@ class AgcVidoe():
|
|
"-map", "0:v:0", # 映射第一个输入的视频流
|
|
"-map", "0:v:0", # 映射第一个输入的视频流
|
|
"-map", "1:a:0", # 映射第二个输入的音频流
|
|
"-map", "1:a:0", # 映射第二个输入的音频流
|
|
"-y", # 覆盖输出文件
|
|
"-y", # 覆盖输出文件
|
|
- "-x264opts",
|
|
|
|
- "keyint=30:min-keyint=5:scenecut=0:ref=5:bframes=3:b-adapt=2:direct=auto:me=umh:subme=7:analyse=all:trellis=2",# 设置关键帧参数
|
|
|
|
v_path
|
|
v_path
|
|
]
|
|
]
|
|
# 构建 FFmpeg 命令,添加字幕
|
|
# 构建 FFmpeg 命令,添加字幕
|