Pygame.movie missing

我与影子孤独终老i 提交于 2019-12-18 09:01:25

问题


I am currently working with a RPi 3B (latest Raspbian Jessie) on a little project which involves playing a short .mp4 file. As Pygame seemed to support playing .mpg files, so I converted my video into that format.

When I tried to import the movie module however, I get the common python import error:

Traceback (most recent call last):
    File "film_app.py", line 3, in <module>
       import pygame.movie
ImportError: No module named movie

After some research, I figured others had the same issue as described here. I did not really understand if there is a solution to it, or what alternatives I have on a RPi.

Pygame, python and Raspbian are up to date.


回答1:


movie is not a sub package of pygame

Use it like this:

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

Note however:

The movie api is deprecated and your pygame will most likely not contain any code for this api.

The code will just throw a NotImplementedError exception.

Sadly you cant use pygame for movies like this anymore.

Here Lenard Lindstrom explains this:

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



来源:https://stackoverflow.com/questions/37775635/pygame-movie-missing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!