python moviepy运行错误,求解

python moviepy运行错误,求解

from moviepy.editor import *
aviFileName = './g550.mp4'
silenceFileName = './g550nonesound.mp4'
video = VideoFileClip(aviFileName)

删除声音

video=video.without_audio()
video.write_videofile(silenceFileName)

运行错误显示如下:
Traceback (most recent call last):
File "u.py", line 4, in <module>

video = VideoFileClip(aviFileName)

File "/usr/local/lib/python3.7/site-packages/moviepy/video/io/VideoFileClip.py", line 91, in init

fps_source=fps_source)

File "/usr/local/lib/python3.7/site-packages/moviepy/video/io/ffmpeg_reader.py", line 33, in init

fps_source)

File "/usr/local/lib/python3.7/site-packages/moviepy/video/io/ffmpeg_reader.py", line 263, in ffmpeg_parse_infos

infos = error.decode('utf8')

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc9 in position 1713: invalid continuation byte


回答:

你的文件中应该有错误,Popen是通过调用外部应用程序来出来的,如果在windows上,外部默认编码我记得是 GBK,用utf8来decode就会报你这个错。归根结底还是文件有问题。

proc = sp.Popen(cmd, **popen_params)

(output, error) = proc.communicate()

以上是 python moviepy运行错误,求解 的全部内容, 来源链接: utcz.com/p/937673.html

回到顶部