问题描述
在将moviepy与"TextClip"一起使用时出现此错误:"utf8"编解码器无法解码位置5的字节0x84:无效的起始字节
i got this error when using moviepy with "TextClip": 'utf8' codec can't decode byte 0x84 in position 5: invalid start byte
已安装Imagemagick和魔杖(正确吗?).有人知道可能的解决方案吗?
Imagemagick and wand are (proper?) installed.Does anybody knows a possible solution?
推荐答案
显然,moviePy需要非unicode字符串(文件moviepy/video/VideoClip.py
,第1095行).解决此问题的方法是在将unicode字符串传递给TextClip之前对其进行解码:
Apparently moviePy expects non unicode strings (file moviepy/video/VideoClip.py
, line 1095). the workaround for this would be to decode your unicode strings before passing them to the TextClip:
if isinstance(mytext, unicode):
mytext = mytext.encode('latin1')
编辑
MoviePy需要UTF8字符串(非unicode),因此以上内容变为
EDIT
MoviePy expects UTF8 strings (non unicode), so the above becomes
if isinstance(mytext, unicode):
mytext_str = mytext.encode('utf8')
这篇关于无法在moviepy中创建文本剪辑(是否成功安装了imagemagick?)-出现Utf8错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!