From: DANNY on
Hello!

I am currently developing a simple video player in python, and my
problem is that i can't find a module which has a function that can
determine if frame(image) is I or P coded (MPEG coding). I have been
using PIL but I couldnt find anything that could help me with that
problem.

Thanks for sugestions!
From: Rhodri James on
On Thu, 11 Feb 2010 19:31:52 -0000, DANNY <danijel.gvero(a)gmail.com> wrote:

> Hello!
>
> I am currently developing a simple video player in python, and my
> problem is that i can't find a module which has a function that can
> determine if frame(image) is I or P coded (MPEG coding). I have been
> using PIL but I couldnt find anything that could help me with that
> problem.

How are you reading the video? PIL doesn't claim to do more than identify
MPEG files. Also, which MPEG encoding, in which container format?

If you aren't just putting a wrapper around something like ffmpeg, I
rather suspect you'll have to decode the bitstream yourself. That could
be rather painful if you're talking about MPEG-4/10.

--
Rhodri James *-* Wildebeeste Herder to the Masses
From: DANNY on
Hy, first thanks for your response!
Well I am thinkin on coding in MPEG4/10, but I would just encode the
video in that encoding,
then stream it with VLC and save the video file on my disc. Then I
would play it with my player....I was thinking on using the image
iterator in PIL...because I would encode the video in GoP of 10 (one I
and 9P), and then I would manipulate it within the sequence...so I
dont have to have a special decoder, because the VLC would already
decode it.
From: Rhodri James on
On Sun, 14 Feb 2010 10:07:35 -0000, DANNY <danijel.gvero(a)gmail.com> wrote:

> Hy, first thanks for your response!
> Well I am thinkin on coding in MPEG4/10, but I would just encode the
> video in that encoding,
> then stream it with VLC and save the video file on my disc. Then I
> would play it with my player....

I think you're misunderstanding what VLC does here. Saving the video file
should preserve format by default; you may be able save it out in YUV
format (I don't have a copy on this machine to check), but that will take
up ludicrous amounts of disc space and you'd still have to write a byte
reader for it. If you do do that, you have lost any chance of knowing
whether a frame was an I or P frame in the original format, not that it
matters anyway by that point.

MPEG-4/10 is hard to write efficient decoders for, and I have to admit I
wouldn't do it in Python. You'd be better off writing a wrapper for one
of the existing MP4 libraries.

--
Rhodri James *-* Wildebeeste Herder to the Masses
From: DANNY on
On Feb 16, 12:53 am, "Rhodri James" <rho...(a)wildebst.demon.co.uk>
wrote:
> On Sun, 14 Feb 2010 10:07:35 -0000, DANNY <danijel.gv...(a)gmail.com> wrote:
> > Hy, first thanks for your response!
> > Well I am thinkin on coding in MPEG4/10, but I would just encode the
> > video in that encoding,
> > then stream it with VLC and save the video file on my disc. Then I
> > would play it with my player....
>
> I think you're misunderstanding what VLC does here.  Saving the video file  
> should preserve format by default; you may be able save it out in YUV  
> format (I don't have a copy on this machine to check), but that will take  
> up ludicrous amounts of disc space and you'd still have to write a byte  
> reader for it.  If you do do that, you have lost any chance of knowing  
> whether a frame was an I or P frame in the original format, not that it  
> matters anyway by that point.
>
> MPEG-4/10 is hard to write efficient decoders for, and I have to admit I  
> wouldn't do it in Python.  You'd be better off writing a wrapper for one  
> of the existing MP4 libraries.
>
> --
> Rhodri James *-* Wildebeeste Herder to the Masses


Hm, well I see that and now I am thinking of using reference software
for MPEG4/10 which is written in c++ http://iphome.hhi.de/suehring/tml/
just to use it as a decoder on my client side, save the file in that
format and then play it in my player using pyffmpeg
http://code.google.com/p/pyffmpeg/ and just manipulate frames in that
clip-I think that could be possible....am I right? Thanks for your
help!