Pygame.movie 失踪

Pygame.movie missing

我目前正在使用 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 是最新的。

movie 不是 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."