Pygame.movie missing [duplicate]
Asked Answered
C

1

5

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.

Caboose answered 12/6, 2016 at 14:54 Comment(1)
Hello and welcome to stackoverflow, The policy is to have only one question per 'page'.You might would like to read this.Sassan
F
8

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

Fineness answered 12/6, 2016 at 15:2 Comment(2)
Now that was simple! I am getting a "NotImplementedError" now however -.-Caboose
pygame.movie was removed: see here. If you want, you can use pygame 1.9.1 instead.Melancholy

© 2022 - 2024 — McMap. All rights reserved.