Pygame's built-in video module is a piece of junk. It's based off of an SMPEG library that, if I recall, is very old and not maintained.
It also only plays MPG (if you're lucky you'll get video, most of the time only sound), so if you're really determined to play videos through Pygame, hooking in Pyglet is the way I figured it out.
Import Pyglet, and create a player and load a video as such:
import pyglet
window = pyglet.window.Window(visible=False)
player = pyglet.media.Player()
player.queue(pyglet.media.load(filename))
player.play()
Then, create the window's draw function:
@window.event
def on_draw():
#We have to convert the Pyglet media player's image to a Pygame surface
rawimage = player.get_texture().get_image_data()
pixels = rawimage.get_data('RGBA', rawimage.width * 4)
video = pygame.image.frombuffer(pixels, (rawimage.width, rawimage.height), 'RGBA')
#Blit the image to the screen
screen.blit(video, (0, 0))
Now that everything is set up, a mainloop for Pyglet must be created.
while True:
pyglet.clock.tick()
for window in pyglet.app.windows:
window.switch_to()
window.dispatch_events()
window.dispatch_event('on_draw')
You can include this code in your regular application loop.
That's it! pyglet.media.player has been able to play any video I've thrown at it, including webm and flv, so it can probably handle anything.
To control the video's flow (seek, pause, stop, etc), use the documentation here:
http://www.pyglet.org/doc/api/pyglet.media.Player-class.html