2016-06-12 76 views
2

我目前正在使用RPi 3B(最新的Raspbian Jessie)在一个小项目上工作,该项目涉及播放一个简短的.mp4文件。由于Pygame似乎支持播放.mpg文件,所以我将视频转换为该格式。Pygame.movi​​e missing

当我试图但是进口电影模块,我得到了普遍的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是最新的。

+1

您好,欢迎光临[计算器](http://stackoverflow.com), 的政策是让每个“page'.You只有一个问题可能会喜欢阅读[this](http://stackoverflow.com/help/how-to-ask)。 –

回答

2

movie不是pygame

子包使用方法如下:

movie = pygame.movie.Movie("file.mpg") 

不过请注意:

电影API已被弃用,你的pygame的将最有可能不包含任何代码为此api。

该代码只会引发NotImplementedError异常。

不幸的是你不能使用pygame来播放这样的电影。

Here莱纳德林川解释这一点:

"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."

+0

现在很简单!然而,我现在正在收到“NotImplementedError” - - – xXliolauXx