提示缺少字体,输出的视频中文为方框
使用的是 Docker 镜像,在Windows 11中部署的。
日志中出现了非常多的缺少字体记录,生成的视频中英文字幕是没问题的,但是中文显示为方框。我需要如何修复它呢? [Parsed_subtitles_3 @ 0x55b9872dde40] Glyph 0x662F not found, selecting one more font for (NotoSansCJK-Regular, 400, 0) [Parsed_subtitles_3 @ 0x55b9872dde40] Glyph 0x4E2A not found, selecting one more font for (NotoSansCJK-Regular, 400, 0) [Parsed_subtitles_3 @ 0x55b9872dde40] Glyph 0x7B11 not found, selecting one more font for (NotoSansCJK-Regular, 400, 0) [Parsed_subtitles_3 @ 0x55b9872dde40] Glyph 0x8BDD not found, selecting one more font for (NotoSansCJK-Regular, 400, 0) [Parsed_subtitles_3 @ 0x55b9872dde40] Glyph 0x5C31 not found, selecting one more font for (NotoSansCJK-Regular, 400, 0) [Parsed_subtitles_3 @ 0x55b9872dde40] Glyph 0x662F not found, selecting one more font for (NotoSansCJK-Regular, 400, 0) [Parsed_subtitles_3 @ 0x55b9872dde40] Glyph 0x554A not found, selecting one more font for (NotoSansCJK-Regular, 400, 0) [Parsed_subtitles_3 @ 0x55b9872dde40] Glyph 0x7B80 not found, selecting one more font for (NotoSansCJK-Regular, 400, 0) [Parsed_subtitles_3 @ 0x55b9872dde40] Glyph 0x76F4 not found, selecting one more font for (NotoSansCJK-Regular, 400, 0) [Parsed_subtitles_3 @ 0x55b9872dde40] Glyph 0x50CF not found, selecting one more font for (NotoSansCJK-Regular, 400, 0) [Parsed_subtitles_3 @ 0x55b9872dde40] Glyph 0x4F01 not found, selecting one more font for (NotoSansCJK-Regular, 400, 0) [Parsed_subtitles_3 @ 0x55b9872dde40] Glyph 0x4E1A not found, selecting one more font for (NotoSansCJK-Regular, 400, 0) [Parsed_subtitles_3 @ 0x55b9872dde40] Glyph 0x673A not found, selecting one more font for (NotoSansCJK-Regular, 400, 0) [Parsed_subtitles_3 @ 0x55b9872dde40] Glyph 0x5668 not found, selecting one more font for (NotoSansCJK-Regular, 400, 0) [Parsed_subtitles_3 @ 0x55b9872dde40] Glyph 0x4EBA not found, selecting one more font for (NotoSansCJK-Regular, 400, 0) [Parsed_subtitles_3 @ 0x55b9872dde40] Glyph 0x771F not found, selecting one more font for (NotoSansCJK-Regular, 400, 0) [Parsed_subtitles_3 @ 0x55b9872dde40] Glyph 0x662F not found, selecting one more font for (NotoSansCJK-Regular, 400, 0)
谢谢反馈~
VideoLingo 在 Dockerfile 中有进行 noto sans 的安装,并且在 core/step7_*.py 中也指定在 Linux 下使用 noto 字体,这是为了解决 linux 上缺少中文字体的问题。
从你的问题来看,似乎已经加载了 notosans 但是 ffmpeg 编码的时候说这些汉字在 notosans 中找不到,这确实很奇怪。GPT 的建议是重新安装/确保你使用的是完整的 Noto Sans CJK 字体包,而不是精简版/更新字体/系统字体缓存。可以尝试一下。
[Parsed_subtitles_2 @ 0x55b986fad580] fontselect: (NotoSansCJK-Regular, 400, 0) -> /usr/share/fonts/truetype/dejavu/DejaVuSans.ttf, 0, DejaVuSans [Parsed_subtitles_3 @ 0x55b9872dde40] fontselect: (NotoSansCJK-Regular, 400, 0) -> /usr/share/fonts/truetype/dejavu/DejaVuSans.ttf, 0, DejaVuSans
这是第一个报错前的输出日志
检查目录也确实存在该文件
进入容器后,apt update , apt install -y fonts-noto-cjk
问题已解决,是否需要更新一下dockerfile?