MoviePy couldn't find the codec associated with the filename. 问题解决

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/ucsheep/article/details/82810291

使用MoviePy出现下面的问题:

Traceback (most recent call last):
  File "/home/ucsheep/git-projects/moviepy/examples/the_end.py", line 24, in <module>
    final.write_videofile("the_end/theEnd.avi")
  File "<decorator-gen-51>", line 2, in write_videofile
  File "/home/ucsheep/git-projects/moviepy/moviepy/decorators.py", line 54, in requires_duration
    return f(clip, *a, **k)
  File "<decorator-gen-50>", line 2, in write_videofile
  File "/home/ucsheep/git-projects/moviepy/moviepy/decorators.py", line 137, in use_clip_fps_by_default
    return f(clip, *new_a, **new_kw)
  File "<decorator-gen-49>", line 2, in write_videofile
  File "/home/ucsheep/git-projects/moviepy/moviepy/decorators.py", line 22, in convert_masks_to_RGB
    return f(clip, *a, **k)
  File "/home/ucsheep/git-projects/moviepy/moviepy/video/VideoClip.py", line 264, in write_videofile
    raise ValueError("MoviePy couldn't find the codec associated "
ValueError: MoviePy couldn't find the codec associated with the filename. Provide the 'codec' parameter in write_videofile.

编解码器找不到,而且是发生在最后写入文件的时候!按照提示,根据文件名找不到编解码器,我这里的文件名是

the_end.avi

明显,是没有avi格式的编解码器,无法写入,解决办法呢

  • 要么换个支持的格式
  • 要么添加avi编解码器

我把the_end.avi替换为the_end.mp4

OK,问题已经解决了

猜你喜欢

转载自blog.csdn.net/ucsheep/article/details/82810291