MoviePy中SubtitlesClip无法识别任何指定字体的问题求助
MoviePy中SubtitlesClip无法识别任何指定字体的问题求助
我最近在尝试用MoviePy给视频添加字幕,但不管怎么调整操作,都会碰到同一个错误。以下是我使用的代码:
from moviepy import TextClip from moviepy.video.tools.subtitles import SubtitlesClip ... generator = lambda txt: TextClip( text = self.txt, font = self.font_path, font_size = 100, color= self.text_color, stroke_color="black", stroke_width=5, ) subtitles = SubtitlesClip(self.subtitles_path, generator)
其中self.font_path目前是字符串"/fonts/my_font.otf",但不管我换成哪种字体,都会出现下面这条错误提示:
ValueError: Invalid font <function _spyderpdb_code.<locals>.<lambda> at 0x7b89f4d60e00>, pillow failed to use it with error 'function' object has no attribute 'read'
备注:内容来源于stack exchange,提问作者Oti
相关产品推荐
相关产品推荐

