gpt4 book ai didi

python - Pygame.movi​​e 丢失

转载 作者:太空宇宙 更新时间:2023-11-03 21:19:35 25 4
gpt4 key购买 nike

我目前正在使用 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."

关于python - Pygame.movi​​e 丢失,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54409572/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com