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

Discussion in 'Python' started by Kilian A. Foth, Sep 28, 2005.

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

    Now, the pygame.Movie documentation says the Movie class can decode
    `MPEG movie files'. 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, `MPEG movie files' means something more
    specific than just `contains MPEG streams'. Does anyone know what
    precisely it means? Even better, how should I instruct transcode or
    similar programs to re-encode existing files so that Movie objhects
    can be created from them?

    --
    No animal was harmed in the composition of this message.
    Kilian A. Foth, Sep 28, 2005
    #1
    1. Advertising

  2. Kilian A. Foth

    accolades Guest

    An MPEG is a type of video file, you are correct in that assumption.
    Things such as DivX and Xvid are called codec's
    (COmpressor/DECompressor) codec's are used to conserve disk space, raw
    video files are very large.

    It is quite likely that PyGame does not support the compression being
    used by your videos. For more information on multimedia files and
    codecs, check out:

    http://www.videohelp.com/

    As for the types of compression (if any) that PyGame supports, I'll
    have to look into that.
    accolades, Sep 28, 2005
    #2
    1. Advertising

  3. Kilian A. Foth

    Christophe Guest

    Kilian A. Foth a écrit :
    > 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...
    >
    > Now, the pygame.Movie documentation says the Movie class can decode
    > `MPEG movie files'. 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, `MPEG movie files' means something more
    > specific than just `contains MPEG streams'. Does anyone know what
    > precisely it means? Even better, how should I instruct transcode or
    > similar programs to re-encode existing files so that Movie objhects
    > can be created from them?


    An mpeg file is a file with the .mpg or .mpeg extension. IIRC, it's a
    raw mpeg 1 or 2 stream dumped in a file. Not sure about the raw stream
    but I'm sure it can only be mpeg 1 or 2.
    Christophe, Sep 28, 2005
    #3
  4. Christophe wrote:
    > Kilian A. Foth a écrit :
    >
    >> 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...
    >>
    >> Now, the pygame.Movie documentation says the Movie class can decode
    >> `MPEG movie files'. 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, `MPEG movie files' means something more
    >> specific than just `contains MPEG streams'. Does anyone know what
    >> precisely it means? Even better, how should I instruct transcode or
    >> similar programs to re-encode existing files so that Movie objhects
    >> can be created from them?

    >
    >
    > An mpeg file is a file with the .mpg or .mpeg extension. IIRC, it's a
    > raw mpeg 1 or 2 stream dumped in a file. Not sure about the raw stream
    > but I'm sure it can only be mpeg 1 or 2.


    I doubt that it is a raw stream dump, since it would have to contain an
    audio and a video stream ?
    There is probably an mpeg container format, such as ogg is only a
    container for vorbis or theora streams.
    Thomas Jollans, Sep 28, 2005
    #4
  5. On 2005-09-28, Kilian A. Foth <-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!!
    Grant Edwards, Sep 28, 2005
    #5
  6. Grant Edwards schreef:
    > 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.


    Nitpick: ogg is not an audio codec, but the container format of
    xiph.org. The lossy audio codec used in the project is called vorbis.
    Besides vorbis and flac there's also speex, designed for speech data.


    --
    If I have been able to see further, it was only because I stood
    on the shoulders of giants. -- Isaac Newton

    Roel Schroeven
    Roel Schroeven, Sep 28, 2005
    #6
  7. On 2005-09-28, Roel Schroeven <> wrote:
    > Grant Edwards schreef:
    >> 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.

    >
    > Nitpick: ogg is not an audio codec, but the container format of
    > xiph.org. The lossy audio codec used in the project is called vorbis.
    > Besides vorbis and flac there's also speex, designed for speech data.


    Ah, thanks for the correction. I had always thought that
    "ogg/vorbis" was the name of the codec, and it should have
    occured to me that ogg was the container format.

    --
    Grant Edwards grante Yow! Hmmm... A hash-singer
    at and a cross-eyed guy were
    visi.com SLEEPING on a deserted
    island, when...
    Grant Edwards, Sep 28, 2005
    #7
  8. Christophe <> wrote:
    > Kilian A. Foth a écrit :
    > > 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...
    > >
    > > Now, the pygame.Movie documentation says the Movie class can decode
    > > `MPEG movie files'. 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, `MPEG movie files' means something more
    > > specific than just `contains MPEG streams'. Does anyone know what
    > > precisely it means? Even better, how should I instruct transcode or
    > > similar programs to re-encode existing files so that Movie objhects
    > > can be created from them?


    > An mpeg file is a file with the .mpg or .mpeg extension. IIRC, it's a
    > raw mpeg 1 or 2 stream dumped in a file. Not sure about the raw stream
    > but I'm sure it can only be mpeg 1 or 2.


    Alright, several tries later I now know the pygame accepts only MPEG
    program stream containers, with MPEG1 video and MPEG2 audio. I found
    that the command

    mencoder -of mpeg -ovc lavc -oac lavc \
    -lavcopts acodec=mp2:vcodec=mpeg1video:vbitrate=5000 -o new.mpg old.avi

    successfully creates such files. I'm off to play video puzzle now!


    --
    No animal was harmed in the composition of this message.
    Kilian A. Foth, Sep 29, 2005
    #8
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Lyndon
    Replies:
    1
    Views:
    510
    Leonard Blaisdell
    Jul 25, 2005
  2. Dean Arpajian
    Replies:
    3
    Views:
    443
    Victor Bazarov
    Nov 16, 2004
  3. AnsNum

    mpeg problem with pygame

    AnsNum, Aug 27, 2003, in forum: Python
    Replies:
    2
    Views:
    701
    Fredrik Lundh
    Aug 27, 2003
  4. rantingrick

    [pygame-bug] Pygame.cdrom bug

    rantingrick, Jan 30, 2011, in forum: Python
    Replies:
    1
    Views:
    299
    Benjamin Kaplan
    Jan 30, 2011
  5. Replies:
    3
    Views:
    147
    Jambalaya
    Oct 12, 2005
Loading...

Share This Page