Page 1 of 1

Pygame movie.play-no sound

Posted: Fri Dec 21, 2012 6:22 am
by Andy_de_jong
Hello.

I get video but no sound when I play videos with the pygame play.movie command. If I use pygame to play an mp3 I do get sound.

My file is using the MPEG-1 Video Codec and the MP3 Audio Codec.

Can anyone point me to a file that they have successfully played? Is there something wrong in my code?

Code: Select all

import pygame
from time import sleep

pygame.init()
screen = pygame.display.set_mode((320,240))
movie=pygame.movie.Movie("o2.mpg")
pygame.mixer.quit()
if (movie.has_audio()):
    print ("movie has audio")
movie.set_volume (1.0)
movie.play()
I am using Python 2.7.3rc2 and 2012-10-28-wheezy-rasbian

Re: Pygame movie.play-no sound

Posted: Sun Dec 23, 2012 8:00 pm
by Andy_de_jong
There was something wrong in my code. I found the following example file which shows the correct method. /usr/share/pyshared/pygame/examples/movieplayer.py

pygame.mixer.quit () needed to be before movie=pygame.movie.Movie ("o2.mpg")