What does pygame.Movie mean by `an MPEG file'?

Grant Edwards grante at visi.com
Wed Sep 28 10:31:10 EDT 2005


On 2005-09-28, Kilian A. Foth <foth at informatik.uni-hamburg.de> wrote:

> I just found this amazing video puzzle game written with the pygame
> library, which promises to be infinite fun - but I can't get it to
> decode any video file I own, except the game's own example .mpg. All I
> have is lots and lots of useless .avi, .mp2, .wmv, and so on...

There are two issues when it comes to video files:

 1) The "container" format.  That defines the mechanism used to
    combine the video and audio data streams into a single byte
    stream (e.g. a file).  This is what is usually denoted by
    file file suffix. Mpeg, wmv, avi are all container file
    formats.

 2) The "Codec" (coder/decoder) used to encode the information
    _within_ the audo or video stream.  mpeg4, mpeg2, divx are
    all video codecs mp3, ac3, flac, ogg are audio codecs.

You can mix and match pretty much any container format with any
video codec and and any audio codec.  
    
> Now, the pygame.Movie documentation says the Movie class can decode
> `MPEG movie files'.

That probably means it understands the mpeg container file
format and the mpeg1 or mpeg2 video codec format.  It might
support the mpeg4 codec as well, but I'd guess mpeg2 is the
most likely.

> I know little about multimedia, but I thought divx/xvid video
> was a variant of MPEG4, and mp3 audio a variant of MPEG1 Layer
> 3. So obviously,

Yes.  But those are codecs.  If the streams aren't in a
recognized container, it doesn't matter what codec was used.
Or, the app may not understand DivX/mpeg4 and may only support
mpeg1/2.

> `MPEG movie files' means something more specific than just
> `contains MPEG streams'. Does anyone know what precisely it
> means?

It doesn't really mean anything precisely.  In order to be
precise, you have to specify the container format and which
codecs are supported.

> Even better, how should I instruct transcode or similar
> programs to re-encode existing files so that Movie objhects
> can be created from them?

I use mencoder (part of mplayer)

  http://www.mplayerhq.hu/homepage/design7/news.html

or tanscode.

  http://freshmeat.net/projects/transcode/

I'd try mpeg container with mpeg2 video.
  
-- 
Grant Edwards                   grante             Yow!  Let's climb to the
                                  at               TOP of that MOUNTAIN and
                               visi.com            think about STRIP MINING!!



More information about the Python-list mailing list