【发布时间】:2021-10-24 17:50:45
【问题描述】:
我正在使用ffmpeg-python 将 SRT 刻录到视频文件中。 我的代码如下所示:
caption_file = "captions.srt"
style = "FontName=Roboto-Regular,FontSize=8"
fonts_dir = "fonts-main/apache"
(
ffmpeg
.concat(video.filter("subtitles", caption_file, fontsdir=fonts_dir, force_style=style), audio, v=1, a=1)
.output("my_video_w_subs.mp4")
.run()
)
当我运行代码时,SRT 确实被烧毁了,但不是以指定的字体(Roboto-Regular)。
这里是输出日志:
[Parsed_subtitles_0 @ 0x55adfd490e80] Loading font file 'fonts-main/apache/Roboto-Regular.ttf'
[Parsed_subtitles_0 @ 0x55adfd490e80] Using font provider fontconfig
[Parsed_subtitles_0 @ 0x55adfd490e80] fontselect: (Roboto-Regular, 400, 0) -> /usr/share/fonts/truetype/dejavu/DejaVuSans.ttf, 0, DejaVuSans
似乎找到并加载了所需的字体,所以我不确定为什么不使用它。
【问题讨论】: