python-Pygame.movie丢失
作者:互联网
我目前正在一个小项目上使用RPi 3B(最新的Raspbian Jessie),该项目涉及播放简短的.mp4文件.由于Pygame似乎支持播放.mpg文件,因此我将视频转换为该格式.
但是,当我尝试导入影片模块时,出现了常见的python导入错误:
Traceback (most recent call last):
File "film_app.py", line 3, in <module>
import pygame.movie
ImportError: No module named movie
经过研究,我发现其他人也遇到了与here相同的问题.我真的不知道是否有解决方案,或者我在RPi上有什么替代方案.
Pygame,python和Raspbian是最新的.
解决方法:
电影不是pygame的子包
像这样使用它:
movie = pygame.movie.Movie("file.mpg")
但是请注意:
电影API已被弃用,您的pygame很可能不包含此API的任何代码.
该代码将仅引发NotImplementedError异常.
遗憾的是,您无法再将pygame用于此类电影.
Here Lenard Lindstrom对此进行了解释:
“Though not properly documented, the pygame.movie module has been
deprecated for some time, and was no longer built by default. The
documented instructions for converting video files to MPEG1 using
ffmpeg are outdated. I built the movie module was built and tested on
32-bit Linux Mint 17.1 (Ubuntu 14.04.2 LTS, Trusty Tahr) and tested it
on a movie converted from MPEG4 using avconv (a fork of ffmpeg);
pygame segfaulted. Also note that pygame.movie was problematic under
Windows.The newer, experimental pygame._movie module, based on ffmpeg, never
worked for me on Linux; it would lock up. Also, libav is now preferred
over ffmpeg on Linux. Furthermore, it relies on SDL overlays, which
disappear in SDL2.As a side note, pygame.examples.movieplayer was re-purposed to use
pygame._movie instead of pygame.movie. This change was undocumented.I like the idea of movie support in Pygame. But pygame.movie uses the
outdated smpeg library, and pygame._movie never quite worked right.
Maybe another movie module can be written based on an existing command
line movie player program.”
标签:movie,raspberry-pi,pygame,python,raspbian 来源: https://codeday.me/bug/20191118/2028957.html