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

K

Kilian A. Foth

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?
 
A

accolades

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

Christophe

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

Thomas Jollans

Christophe said:
Kilian A. Foth a écrit :



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

Grant Edwards

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

Roel Schroeven

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

Grant Edwards

Grant Edwards schreef:

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

Kilian A. Foth

Christophe said:
Kilian A. Foth a écrit :
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!
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,012
Latest member
RoxanneDzm

Latest Threads

Top