Upload 2 files
Browse files- Dockerfile +9 -4
- app.py +3 -6
Dockerfile
CHANGED
@@ -5,14 +5,19 @@ WORKDIR /app
|
|
5 |
# 安装FFmpeg
|
6 |
RUN apt-get update && \
|
7 |
apt-get install -y ffmpeg \
|
8 |
-
fonts-noto-cjk \
|
9 |
-
fonts-noto-color-emoji \
|
10 |
fontconfig && \
|
11 |
apt-get clean && \
|
12 |
rm -rf /var/lib/apt/lists/*
|
13 |
|
14 |
-
#
|
15 |
-
RUN
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
|
17 |
# 安装Python依赖
|
18 |
COPY requirements.txt .
|
|
|
5 |
# 安装FFmpeg
|
6 |
RUN apt-get update && \
|
7 |
apt-get install -y ffmpeg \
|
|
|
|
|
8 |
fontconfig && \
|
9 |
apt-get clean && \
|
10 |
rm -rf /var/lib/apt/lists/*
|
11 |
|
12 |
+
# 创建字体目录
|
13 |
+
RUN mkdir -p /usr/share/fonts/windows
|
14 |
+
|
15 |
+
# 复制宋体文件到镜像中
|
16 |
+
COPY ./fonts/simsun.ttc /usr/share/fonts/windows/
|
17 |
+
|
18 |
+
# 设置字体权限并更新字体缓存
|
19 |
+
RUN chmod 644 /usr/share/fonts/windows/*.tt* && \
|
20 |
+
fc-cache -fv
|
21 |
|
22 |
# 安装Python依赖
|
23 |
COPY requirements.txt .
|
app.py
CHANGED
@@ -302,10 +302,7 @@ def create_video(project_dir, image_paths, caption_subtitle_file, speech_subtitl
|
|
302 |
"ffmpeg", "-y",
|
303 |
"-f", "concat", "-safe", "0", "-i", frames_list,
|
304 |
"-i", audio_file,
|
305 |
-
"-c:v", "libx264",
|
306 |
-
"-pix_fmt", "yuv420p",
|
307 |
-
"-color_range", "tv", # 添加这一行,指定色彩范围为tv(mpeg)
|
308 |
-
"-colorspace", "bt709", # 添加这行,指定色彩空间
|
309 |
"-c:a", "aac", "-strict", "experimental",
|
310 |
"-vsync", "vfr", # 确保视频帧率与时间轴匹配
|
311 |
"-async", "1", # 音频同步
|
@@ -320,7 +317,7 @@ def create_video(project_dir, image_paths, caption_subtitle_file, speech_subtitl
|
|
320 |
combined_filter = (
|
321 |
f"subtitles={process_sub_path(caption_subtitle_file)}:"
|
322 |
"force_style='"
|
323 |
-
"FontName=
|
324 |
"Fontsize={},"
|
325 |
"Alignment=2,"
|
326 |
"MarginV={},"
|
@@ -330,7 +327,7 @@ def create_video(project_dir, image_paths, caption_subtitle_file, speech_subtitl
|
|
330 |
),
|
331 |
f"subtitles={process_sub_path(speech_subtitle_file)}:"
|
332 |
"force_style='"
|
333 |
-
"FontName=
|
334 |
"Fontsize={},"
|
335 |
"Alignment=8,"
|
336 |
"MarginV={},"
|
|
|
302 |
"ffmpeg", "-y",
|
303 |
"-f", "concat", "-safe", "0", "-i", frames_list,
|
304 |
"-i", audio_file,
|
305 |
+
"-c:v", "libx264", "-pix_fmt", "yuv420p",
|
|
|
|
|
|
|
306 |
"-c:a", "aac", "-strict", "experimental",
|
307 |
"-vsync", "vfr", # 确保视频帧率与时间轴匹配
|
308 |
"-async", "1", # 音频同步
|
|
|
317 |
combined_filter = (
|
318 |
f"subtitles={process_sub_path(caption_subtitle_file)}:"
|
319 |
"force_style='"
|
320 |
+
"FontName=SimSun,"
|
321 |
"Fontsize={},"
|
322 |
"Alignment=2,"
|
323 |
"MarginV={},"
|
|
|
327 |
),
|
328 |
f"subtitles={process_sub_path(speech_subtitle_file)}:"
|
329 |
"force_style='"
|
330 |
+
"FontName=SimSun,"
|
331 |
"Fontsize={},"
|
332 |
"Alignment=8,"
|
333 |
"MarginV={},"
|