Re: [pygame] pyg_mixer.music.load doesn't take non ascii chars

2015-02-13 Thread Greg Ewing

Bo Jangeborg wrote:

file_path = "07-Boabdil, Bulerías.ogg"
fi = open(file_path, 'rb').read()
pygame.mixer.music.load(fi)

But that gets me the Error:
"File path 'OggS' contains null characters"


music.load() expects to be passed the name of a file,
not the contents of the file. Just do this:

file_path = "07-Boabdil, Bulerías.ogg"
pygame.mixer.music.load(file_path)

--
Greg


Re: [pygame] pyg_mixer.music.load doesn't take non ascii chars

2015-02-13 Thread Bo Jangeborg

If I change the single letter that is outside of the
ascii range the file loads perfectly.
os.exists(file_path) evaluates as true even with
the special character so there is nothing
wrong with the file_path.

Gino Ingras skrev den 2015-02-14 02:13:

do you had try
file_path.replace(' ', '\\ ')
?

2015-02-14 1:23 GMT+01:00 Bo Jangeborg >:


I am trying to open an ogg file with:

file_path = "07-Boabdil, Bulerías.ogg"
 pygame.mixer.music.load(file_path)

But I get an Error message saying that one of the unicode characters
 are out of range and can not be encoded. If I remove the offending
character the file loads fine so I assume the problem is that only
ascii
is accepted.

Since os.exists(file_path) evaluates as true I tried using the
following:

file_path = "07-Boabdil, Bulerías.ogg"
fi = open(file_path, 'rb').read()
pygame.mixer.music.load(fi)

But that gets me the Error:
"File path 'OggS' contains null characters"

Am I doing something wrong or is there no way
to open a soundfile with non ascii characters ?
I am running pygame on Windows 7.

Bo Jangeborg






Re: [pygame] pyg_mixer.music.load doesn't take non ascii chars

2015-02-13 Thread Gino Ingras
do you had try
file_path.replace(' ', '\\ ')
?

2015-02-14 1:23 GMT+01:00 Bo Jangeborg :

> I am trying to open an ogg file with:
>
> file_path = "07-Boabdil, Bulerías.ogg"
>  pygame.mixer.music.load(file_path)
>
> But I get an Error message saying that one of the unicode characters
>  are out of range and can not be encoded. If I remove the offending
> character the file loads fine so I assume the problem is that only ascii
> is accepted.
>
> Since os.exists(file_path) evaluates as true I tried using the following:
>
> file_path = "07-Boabdil, Bulerías.ogg"
> fi = open(file_path, 'rb').read()
> pygame.mixer.music.load(fi)
>
> But that gets me the Error:
> "File path 'OggS' contains null characters"
>
> Am I doing something wrong or is there no way
> to open a soundfile with non ascii characters ?
> I am running pygame on Windows 7.
>
> Bo Jangeborg
>


Re: [pygame] Pygame non-MPEG1 video options?

2015-02-13 Thread Brian Madden
Hi Ted,

Thanks for these ideas! I'll try those settings for ffmpeg, but yeah, I
already learned that the movie module isn't in Pygame for Mac.

I'd love an example of the pipe to ffmpeg, either here or off list via my
email br...@missionpinball.com. I assume that you get the pixels for a
frame from ffmpeg and then blit them to a pygame surface manually?

Thanks!
Brian

On Fri, Feb 13, 2015 at 4:27 PM, Ted Hunt  wrote:

>  Hi Brian,
>
> I had a similar problem to you (wrote an app thinking I'd be able to play
> video, only to later find problems). I did manage to get the movie module
> in pygame to play HD video. Here's the ffmpeg command I used to encode the
> video :-
>
> ffmpeg -r 24 -f image2 -i SD%%04d.png -r 24 -g 18 -s 1920x1080 -vcodec
> mpeg1video -b:v 6000k -minrate 6000K -maxrate 6000k -bufsize 3276800 -intra
> SD.mpg
>
> I think the trick is using a fixed bit rate. If while encoding ffmpeg
> reports a buffer underflow, then you'll need to increase the bit rate
> (always keep -b:v, -minrate and -maxrate the same).
>
> Another problem which you may or may not discover is that not all pygame
> versions include the movie module. And it's possible that the movie module
> will be dropped in future versions. Because of this I decided not to use
> the movie module and instead I open a pipe to ffmpeg to decode my videos.
> The disadvantage with this is that ffmpeg has to be available to your app.
> The advantage is that you can use any encoding method ffmpeg supports. If
> you need an example of opening a pipe to ffmpeg, just let me know.
>
> Cheers,
>
> Ted.
>
>
>
> On 14/02/2015 6:41 a.m., Brian Madden wrote:
>
> Hi Everyone,
>
>  I have a Python app that's pretty much ready to go. Problem is that we
> need to be able to play videos. To be honest I never really looked too deep
> into Pygame's video support. I knew from the docs that it had to be MPEG-1
> and that if you wanted audio then it had to have exclusive control of
> Pygame.media, so I kind of thought, "Ok, that's fine, I'll deal with all
> that later."
>
>  So now it's "later" and I'm dealing with it. :)
>
>  Problem is that we cannot get videos converted to MPEG-1 in a way that
> works reliably. We've gone through all the posts on this list and read a
> lot. Sometimes the videos play, sometimes not, sometimes we get SDL errors,
> sometimes we get garbage on the screen.. It's really kind of a mess.
>
>  So I've started looking into options for non-MPEG1 videos and I wonder
> if anyone has successfully done anything?
>
>  I found a blog post where a guy wrote a simple app that uses Pyglet to
> play the video and then for each frame it converts the Pyglet video frame
> to a Pyglet texture (kind of like Pyglet's version of a Surface), converts
> the pixels to a ctype, converts the ctype to the format Pygame can use,
> converts it to an image, then blits it to the Pygame window surface. That
> technically works but it's far too slow.. for hi-def videos we're only
> getting about 10fps.
>
>  So I wonder if there are any other alternatives? Like can we install
> SDL2 and use PySDL2 to play the video and somehow convert that to a Pygame
> surface? (I have no idea if surfaces between SDL1.2 and SDL2 are
> compatible, or if so if it would be possible to get them into Pygame.)
>
>  Or are there any other crazy ideas?
>
>  To be honest if we can't figure this out then I think we're going to
> have to go with something other than Pygame, which would be a lot of work,
> but I don't know of any other alternatives? Unfortunately I don't know C or
> C++ so I'm afraid I'm not much help in terms of contributing to Pygame.
>
>  Has anyone successfully taken a Python project based on Pygame and
> converted it to PySDL2? From what I've read it seems like there are many
> similarities since they're both SDL, but I don't know how much "other" work
> Pygame is doing, and whether if I recreated any of that in Python it will
> be fast enough?
>
>  Anyway, sorry I'm a bit all over the place. I wonder if anyone has any
> thoughts to share?
>
>  Thanks,
> Brian
>
>  --
>  *Brian Madden*
> Mission Pinball (blog  | twitter
>  | MPF software framework
>  | sample games
> )
>
>
>
>
> --
>
>
> This email is free from viruses and malware because avast! Antivirus
>  protection is active.
>
>


-- 
*Brian Madden*
Mission Pinball (blog  | twitter
 | MPF software framework
 | sample games
)


Re: [pygame] Pygame non-MPEG1 video options?

2015-02-13 Thread Ted Hunt

Hi Brian,

I had a similar problem to you (wrote an app thinking I'd be able to 
play video, only to later find problems). I did manage to get the movie 
module in pygame to play HD video. Here's the ffmpeg command I used to 
encode the video :-


ffmpeg -r 24 -f image2 -i SD%%04d.png -r 24 -g 18 -s 1920x1080 -vcodec 
mpeg1video -b:v 6000k -minrate 6000K -maxrate 6000k -bufsize 3276800 
-intra SD.mpg


I think the trick is using a fixed bit rate. If while encoding ffmpeg 
reports a buffer underflow, then you'll need to increase the bit rate 
(always keep -b:v, -minrate and -maxrate the same).


Another problem which you may or may not discover is that not all pygame 
versions include the movie module. And it's possible that the movie 
module will be dropped in future versions. Because of this I decided not 
to use the movie module and instead I open a pipe to ffmpeg to decode my 
videos. The disadvantage with this is that ffmpeg has to be available to 
your app. The advantage is that you can use any encoding method ffmpeg 
supports. If you need an example of opening a pipe to ffmpeg, just let 
me know.


Cheers,

Ted.


On 14/02/2015 6:41 a.m., Brian Madden wrote:

Hi Everyone,

I have a Python app that's pretty much ready to go. Problem is that we 
need to be able to play videos. To be honest I never really looked too 
deep into Pygame's video support. I knew from the docs that it had to 
be MPEG-1 and that if you wanted audio then it had to have exclusive 
control of Pygame.media, so I kind of thought, "Ok, that's fine, I'll 
deal with all that later."


So now it's "later" and I'm dealing with it. :)

Problem is that we cannot get videos converted to MPEG-1 in a way that 
works reliably. We've gone through all the posts on this list and read 
a lot. Sometimes the videos play, sometimes not, sometimes we get SDL 
errors, sometimes we get garbage on the screen.. It's really kind of a 
mess.


So I've started looking into options for non-MPEG1 videos and I wonder 
if anyone has successfully done anything?


I found a blog post where a guy wrote a simple app that uses Pyglet to 
play the video and then for each frame it converts the Pyglet video 
frame to a Pyglet texture (kind of like Pyglet's version of a 
Surface), converts the pixels to a ctype, converts the ctype to the 
format Pygame can use, converts it to an image, then blits it to the 
Pygame window surface. That technically works but it's far too slow.. 
for hi-def videos we're only getting about 10fps.


So I wonder if there are any other alternatives? Like can we install 
SDL2 and use PySDL2 to play the video and somehow convert that to a 
Pygame surface? (I have no idea if surfaces between SDL1.2 and SDL2 
are compatible, or if so if it would be possible to get them into Pygame.)


Or are there any other crazy ideas?

To be honest if we can't figure this out then I think we're going to 
have to go with something other than Pygame, which would be a lot of 
work, but I don't know of any other alternatives? Unfortunately I 
don't know C or C++ so I'm afraid I'm not much help in terms of 
contributing to Pygame.


Has anyone successfully taken a Python project based on Pygame and 
converted it to PySDL2? From what I've read it seems like there are 
many similarities since they're both SDL, but I don't know how much 
"other" work Pygame is doing, and whether if I recreated any of that 
in Python it will be fast enough?


Anyway, sorry I'm a bit all over the place. I wonder if anyone has any 
thoughts to share?


Thanks,
Brian

--
*Brian Madden*
Mission Pinball (blog  | twitter 
 | MPF software framework 
 | sample games 
)




---
This email is free from viruses and malware because avast! Antivirus protection 
is active.
http://www.avast.com


[pygame] pyg_mixer.music.load doesn't take non ascii chars

2015-02-13 Thread Bo Jangeborg

I am trying to open an ogg file with:

file_path = "07-Boabdil, Bulerías.ogg"
 pygame.mixer.music.load(file_path)

But I get an Error message saying that one of the unicode characters
 are out of range and can not be encoded. If I remove the offending
character the file loads fine so I assume the problem is that only ascii
is accepted.

Since os.exists(file_path) evaluates as true I tried using the following:

file_path = "07-Boabdil, Bulerías.ogg"
fi = open(file_path, 'rb').read()
pygame.mixer.music.load(fi)

But that gets me the Error:
"File path 'OggS' contains null characters"

Am I doing something wrong or is there no way
to open a soundfile with non ascii characters ?
I am running pygame on Windows 7.

Bo Jangeborg


Re: [pygame] Pygame non-MPEG1 video options?

2015-02-13 Thread Jason Marshall
ffmpeg is a good tool for converting to MPEG1. Questions:

What is your operating system?What version of pygame are you using?
What computer hardware are you using (CPU and GPU)?
According to pygame.display.get_driver(), what video driver is being used?Are 
you running full-screen or windowed?
What is the resolution of the video?Are you loading the video file from your 
hard drive or from a network location?

Jason




From: Brian Madden 
To: pygame-users@seul.org 
Sent: Friday, February 13, 2015 11:59 AM
Subject: Re: [pygame] Pygame non-MPEG1 video options?


Oh man that would be awesome! Unfortunately Pygame can't do that (unless I'm 
missing something)...


Anyone else?




On Fri, Feb 13, 2015 at 9:45 AM, Charles Cossé  wrote:

Hi Brian,

Don't know if possible, but if i were you i'd investigate embedding your 
videos.  Is there any html support in pygame?  I don't know, personally, but if 
yes then that's the way i'd suggest ...
good luck,
Charles


On Fri, Feb 13, 2015 at 10:41 AM, Brian Madden  wrote:

Hi Everyone,


I have a Python app that's pretty much ready to go. Problem is that we need to 
be able to play videos. To be honest I never really looked too deep into 
Pygame's video support. I knew from the docs that it had to be MPEG-1 and that 
if you wanted audio then it had to have exclusive control of Pygame.media, so I 
kind of thought, "Ok, that's fine, I'll deal with all that later."


So now it's "later" and I'm dealing with it. :)


Problem is that we cannot get videos converted to MPEG-1 in a way that works 
reliably. We've gone through all the posts on this list and read a lot. 
Sometimes the videos play, sometimes not, sometimes we get SDL errors, 
sometimes we get garbage on the screen.. It's really kind of a mess.


So I've started looking into options for non-MPEG1 videos and I wonder if 
anyone has successfully done anything?


I found a blog post where a guy wrote a simple app that uses Pyglet to play the 
video and then for each frame it converts the Pyglet video frame to a Pyglet 
texture (kind of like Pyglet's version of a Surface), converts the pixels to a 
ctype, converts the ctype to the format Pygame can use, converts it to an 
image, then blits it to the Pygame window surface. That technically works but 
it's far too slow.. for hi-def videos we're only getting about 10fps.


So I wonder if there are any other alternatives? Like can we install SDL2 and 
use PySDL2 to play the video and somehow convert that to a Pygame surface? (I 
have no idea if surfaces between SDL1.2 and SDL2 are compatible, or if so if it 
would be possible to get them into Pygame.)


Or are there any other crazy ideas?


To be honest if we can't figure this out then I think we're going to have to go 
with something other than Pygame, which would be a lot of work, but I don't 
know of any other alternatives? Unfortunately I don't know C or C++ so I'm 
afraid I'm not much help in terms of contributing to Pygame.


Has anyone successfully taken a Python project based on Pygame and converted it 
to PySDL2? From what I've read it seems like there are many similarities since 
they're both SDL, but I don't know how much "other" work Pygame is doing, and 
whether if I recreated any of that in Python it will be fast enough?


Anyway, sorry I'm a bit all over the place. I wonder if anyone has any thoughts 
to share?


Thanks,

Brian


-- 

Brian Madden

Mission Pinball (blog | twitter | MPF software framework | sample games)





-- 

Brian Madden

Mission Pinball (blog | twitter | MPF software framework | sample games)





Re: [pygame] Pygame non-MPEG1 video options?

2015-02-13 Thread Charles Cossé
Oh, I just thought of another way based on what Gino just suggested.   It
is possible to use PyGame and wxPython in the same application ... I've
been doing that for years ... and wxPython/wxWidgets has html support so
you could embed videos.  It requires another separate wx window, and thus
it would be a solution somewhat half-way between pure pygame and pure
external as Gino proposed.

On Fri, Feb 13, 2015 at 12:57 PM, Gino Ingras  wrote:

> if you just want to play a movie, you can do it outside pygame, using
> others python binding, such as mpylayer.
>
> - run the pygame appllication.
> - launch the movie.
> - stop the movie.
> - return to pygame screen.
>
>
> 2015-02-13 18:59 GMT+01:00 Brian Madden :
>
>> Oh man that would be awesome! Unfortunately Pygame can't do that (unless
>> I'm missing something)...
>>
>> Anyone else?
>>
>> On Fri, Feb 13, 2015 at 9:45 AM, Charles Cossé  wrote:
>>
>>> Hi Brian,
>>> Don't know if possible, but if i were you i'd investigate embedding your
>>> videos.  Is there any html support in pygame?  I don't know, personally,
>>> but if yes then that's the way i'd suggest ...
>>> good luck,
>>> Charles
>>>
>>> On Fri, Feb 13, 2015 at 10:41 AM, Brian Madden >> > wrote:
>>>
 Hi Everyone,

 I have a Python app that's pretty much ready to go. Problem is that we
 need to be able to play videos. To be honest I never really looked too deep
 into Pygame's video support. I knew from the docs that it had to be MPEG-1
 and that if you wanted audio then it had to have exclusive control of
 Pygame.media, so I kind of thought, "Ok, that's fine, I'll deal with all
 that later."

 So now it's "later" and I'm dealing with it. :)

 Problem is that we cannot get videos converted to MPEG-1 in a way that
 works reliably. We've gone through all the posts on this list and read a
 lot. Sometimes the videos play, sometimes not, sometimes we get SDL errors,
 sometimes we get garbage on the screen.. It's really kind of a mess.

 So I've started looking into options for non-MPEG1 videos and I wonder
 if anyone has successfully done anything?

 I found a blog post where a guy wrote a simple app that uses Pyglet to
 play the video and then for each frame it converts the Pyglet video frame
 to a Pyglet texture (kind of like Pyglet's version of a Surface), converts
 the pixels to a ctype, converts the ctype to the format Pygame can use,
 converts it to an image, then blits it to the Pygame window surface. That
 technically works but it's far too slow.. for hi-def videos we're only
 getting about 10fps.

 So I wonder if there are any other alternatives? Like can we install
 SDL2 and use PySDL2 to play the video and somehow convert that to a Pygame
 surface? (I have no idea if surfaces between SDL1.2 and SDL2 are
 compatible, or if so if it would be possible to get them into Pygame.)

 Or are there any other crazy ideas?

 To be honest if we can't figure this out then I think we're going to
 have to go with something other than Pygame, which would be a lot of work,
 but I don't know of any other alternatives? Unfortunately I don't know C or
 C++ so I'm afraid I'm not much help in terms of contributing to Pygame.

 Has anyone successfully taken a Python project based on Pygame and
 converted it to PySDL2? From what I've read it seems like there are many
 similarities since they're both SDL, but I don't know how much "other" work
 Pygame is doing, and whether if I recreated any of that in Python it will
 be fast enough?

 Anyway, sorry I'm a bit all over the place. I wonder if anyone has any
 thoughts to share?

 Thanks,
 Brian

 --
 *Brian Madden*
 Mission Pinball (blog  | twitter
  | MPF software framework
  | sample games
 )

>>>
>>>
>>
>>
>> --
>> *Brian Madden*
>> Mission Pinball (blog  | twitter
>>  | MPF software framework
>>  | sample games
>> )
>>
>
>


Re: [pygame] Pygame non-MPEG1 video options?

2015-02-13 Thread Gino Ingras
if you just want to play a movie, you can do it outside pygame, using
others python binding, such as mpylayer.

- run the pygame appllication.
- launch the movie.
- stop the movie.
- return to pygame screen.


2015-02-13 18:59 GMT+01:00 Brian Madden :

> Oh man that would be awesome! Unfortunately Pygame can't do that (unless
> I'm missing something)...
>
> Anyone else?
>
> On Fri, Feb 13, 2015 at 9:45 AM, Charles Cossé  wrote:
>
>> Hi Brian,
>> Don't know if possible, but if i were you i'd investigate embedding your
>> videos.  Is there any html support in pygame?  I don't know, personally,
>> but if yes then that's the way i'd suggest ...
>> good luck,
>> Charles
>>
>> On Fri, Feb 13, 2015 at 10:41 AM, Brian Madden 
>> wrote:
>>
>>> Hi Everyone,
>>>
>>> I have a Python app that's pretty much ready to go. Problem is that we
>>> need to be able to play videos. To be honest I never really looked too deep
>>> into Pygame's video support. I knew from the docs that it had to be MPEG-1
>>> and that if you wanted audio then it had to have exclusive control of
>>> Pygame.media, so I kind of thought, "Ok, that's fine, I'll deal with all
>>> that later."
>>>
>>> So now it's "later" and I'm dealing with it. :)
>>>
>>> Problem is that we cannot get videos converted to MPEG-1 in a way that
>>> works reliably. We've gone through all the posts on this list and read a
>>> lot. Sometimes the videos play, sometimes not, sometimes we get SDL errors,
>>> sometimes we get garbage on the screen.. It's really kind of a mess.
>>>
>>> So I've started looking into options for non-MPEG1 videos and I wonder
>>> if anyone has successfully done anything?
>>>
>>> I found a blog post where a guy wrote a simple app that uses Pyglet to
>>> play the video and then for each frame it converts the Pyglet video frame
>>> to a Pyglet texture (kind of like Pyglet's version of a Surface), converts
>>> the pixels to a ctype, converts the ctype to the format Pygame can use,
>>> converts it to an image, then blits it to the Pygame window surface. That
>>> technically works but it's far too slow.. for hi-def videos we're only
>>> getting about 10fps.
>>>
>>> So I wonder if there are any other alternatives? Like can we install
>>> SDL2 and use PySDL2 to play the video and somehow convert that to a Pygame
>>> surface? (I have no idea if surfaces between SDL1.2 and SDL2 are
>>> compatible, or if so if it would be possible to get them into Pygame.)
>>>
>>> Or are there any other crazy ideas?
>>>
>>> To be honest if we can't figure this out then I think we're going to
>>> have to go with something other than Pygame, which would be a lot of work,
>>> but I don't know of any other alternatives? Unfortunately I don't know C or
>>> C++ so I'm afraid I'm not much help in terms of contributing to Pygame.
>>>
>>> Has anyone successfully taken a Python project based on Pygame and
>>> converted it to PySDL2? From what I've read it seems like there are many
>>> similarities since they're both SDL, but I don't know how much "other" work
>>> Pygame is doing, and whether if I recreated any of that in Python it will
>>> be fast enough?
>>>
>>> Anyway, sorry I'm a bit all over the place. I wonder if anyone has any
>>> thoughts to share?
>>>
>>> Thanks,
>>> Brian
>>>
>>> --
>>> *Brian Madden*
>>> Mission Pinball (blog  | twitter
>>>  | MPF software framework
>>>  | sample games
>>> )
>>>
>>
>>
>
>
> --
> *Brian Madden*
> Mission Pinball (blog  | twitter
>  | MPF software framework
>  | sample games
> )
>


Re: [pygame] Pygame non-MPEG1 video options?

2015-02-13 Thread Brian Madden
Oh man that would be awesome! Unfortunately Pygame can't do that (unless
I'm missing something)...

Anyone else?

On Fri, Feb 13, 2015 at 9:45 AM, Charles Cossé  wrote:

> Hi Brian,
> Don't know if possible, but if i were you i'd investigate embedding your
> videos.  Is there any html support in pygame?  I don't know, personally,
> but if yes then that's the way i'd suggest ...
> good luck,
> Charles
>
> On Fri, Feb 13, 2015 at 10:41 AM, Brian Madden 
> wrote:
>
>> Hi Everyone,
>>
>> I have a Python app that's pretty much ready to go. Problem is that we
>> need to be able to play videos. To be honest I never really looked too deep
>> into Pygame's video support. I knew from the docs that it had to be MPEG-1
>> and that if you wanted audio then it had to have exclusive control of
>> Pygame.media, so I kind of thought, "Ok, that's fine, I'll deal with all
>> that later."
>>
>> So now it's "later" and I'm dealing with it. :)
>>
>> Problem is that we cannot get videos converted to MPEG-1 in a way that
>> works reliably. We've gone through all the posts on this list and read a
>> lot. Sometimes the videos play, sometimes not, sometimes we get SDL errors,
>> sometimes we get garbage on the screen.. It's really kind of a mess.
>>
>> So I've started looking into options for non-MPEG1 videos and I wonder if
>> anyone has successfully done anything?
>>
>> I found a blog post where a guy wrote a simple app that uses Pyglet to
>> play the video and then for each frame it converts the Pyglet video frame
>> to a Pyglet texture (kind of like Pyglet's version of a Surface), converts
>> the pixels to a ctype, converts the ctype to the format Pygame can use,
>> converts it to an image, then blits it to the Pygame window surface. That
>> technically works but it's far too slow.. for hi-def videos we're only
>> getting about 10fps.
>>
>> So I wonder if there are any other alternatives? Like can we install SDL2
>> and use PySDL2 to play the video and somehow convert that to a Pygame
>> surface? (I have no idea if surfaces between SDL1.2 and SDL2 are
>> compatible, or if so if it would be possible to get them into Pygame.)
>>
>> Or are there any other crazy ideas?
>>
>> To be honest if we can't figure this out then I think we're going to have
>> to go with something other than Pygame, which would be a lot of work, but I
>> don't know of any other alternatives? Unfortunately I don't know C or C++
>> so I'm afraid I'm not much help in terms of contributing to Pygame.
>>
>> Has anyone successfully taken a Python project based on Pygame and
>> converted it to PySDL2? From what I've read it seems like there are many
>> similarities since they're both SDL, but I don't know how much "other" work
>> Pygame is doing, and whether if I recreated any of that in Python it will
>> be fast enough?
>>
>> Anyway, sorry I'm a bit all over the place. I wonder if anyone has any
>> thoughts to share?
>>
>> Thanks,
>> Brian
>>
>> --
>> *Brian Madden*
>> Mission Pinball (blog  | twitter
>>  | MPF software framework
>>  | sample games
>> )
>>
>
>


-- 
*Brian Madden*
Mission Pinball (blog  | twitter
 | MPF software framework
 | sample games
)


Re: [pygame] Pygame non-MPEG1 video options?

2015-02-13 Thread Charles Cossé
Hi Brian,
Don't know if possible, but if i were you i'd investigate embedding your
videos.  Is there any html support in pygame?  I don't know, personally,
but if yes then that's the way i'd suggest ...
good luck,
Charles

On Fri, Feb 13, 2015 at 10:41 AM, Brian Madden 
wrote:

> Hi Everyone,
>
> I have a Python app that's pretty much ready to go. Problem is that we
> need to be able to play videos. To be honest I never really looked too deep
> into Pygame's video support. I knew from the docs that it had to be MPEG-1
> and that if you wanted audio then it had to have exclusive control of
> Pygame.media, so I kind of thought, "Ok, that's fine, I'll deal with all
> that later."
>
> So now it's "later" and I'm dealing with it. :)
>
> Problem is that we cannot get videos converted to MPEG-1 in a way that
> works reliably. We've gone through all the posts on this list and read a
> lot. Sometimes the videos play, sometimes not, sometimes we get SDL errors,
> sometimes we get garbage on the screen.. It's really kind of a mess.
>
> So I've started looking into options for non-MPEG1 videos and I wonder if
> anyone has successfully done anything?
>
> I found a blog post where a guy wrote a simple app that uses Pyglet to
> play the video and then for each frame it converts the Pyglet video frame
> to a Pyglet texture (kind of like Pyglet's version of a Surface), converts
> the pixels to a ctype, converts the ctype to the format Pygame can use,
> converts it to an image, then blits it to the Pygame window surface. That
> technically works but it's far too slow.. for hi-def videos we're only
> getting about 10fps.
>
> So I wonder if there are any other alternatives? Like can we install SDL2
> and use PySDL2 to play the video and somehow convert that to a Pygame
> surface? (I have no idea if surfaces between SDL1.2 and SDL2 are
> compatible, or if so if it would be possible to get them into Pygame.)
>
> Or are there any other crazy ideas?
>
> To be honest if we can't figure this out then I think we're going to have
> to go with something other than Pygame, which would be a lot of work, but I
> don't know of any other alternatives? Unfortunately I don't know C or C++
> so I'm afraid I'm not much help in terms of contributing to Pygame.
>
> Has anyone successfully taken a Python project based on Pygame and
> converted it to PySDL2? From what I've read it seems like there are many
> similarities since they're both SDL, but I don't know how much "other" work
> Pygame is doing, and whether if I recreated any of that in Python it will
> be fast enough?
>
> Anyway, sorry I'm a bit all over the place. I wonder if anyone has any
> thoughts to share?
>
> Thanks,
> Brian
>
> --
> *Brian Madden*
> Mission Pinball (blog  | twitter
>  | MPF software framework
>  | sample games
> )
>


[pygame] Pygame non-MPEG1 video options?

2015-02-13 Thread Brian Madden
Hi Everyone,

I have a Python app that's pretty much ready to go. Problem is that we need
to be able to play videos. To be honest I never really looked too deep into
Pygame's video support. I knew from the docs that it had to be MPEG-1 and
that if you wanted audio then it had to have exclusive control of
Pygame.media, so I kind of thought, "Ok, that's fine, I'll deal with all
that later."

So now it's "later" and I'm dealing with it. :)

Problem is that we cannot get videos converted to MPEG-1 in a way that
works reliably. We've gone through all the posts on this list and read a
lot. Sometimes the videos play, sometimes not, sometimes we get SDL errors,
sometimes we get garbage on the screen.. It's really kind of a mess.

So I've started looking into options for non-MPEG1 videos and I wonder if
anyone has successfully done anything?

I found a blog post where a guy wrote a simple app that uses Pyglet to play
the video and then for each frame it converts the Pyglet video frame to a
Pyglet texture (kind of like Pyglet's version of a Surface), converts the
pixels to a ctype, converts the ctype to the format Pygame can use,
converts it to an image, then blits it to the Pygame window surface. That
technically works but it's far too slow.. for hi-def videos we're only
getting about 10fps.

So I wonder if there are any other alternatives? Like can we install SDL2
and use PySDL2 to play the video and somehow convert that to a Pygame
surface? (I have no idea if surfaces between SDL1.2 and SDL2 are
compatible, or if so if it would be possible to get them into Pygame.)

Or are there any other crazy ideas?

To be honest if we can't figure this out then I think we're going to have
to go with something other than Pygame, which would be a lot of work, but I
don't know of any other alternatives? Unfortunately I don't know C or C++
so I'm afraid I'm not much help in terms of contributing to Pygame.

Has anyone successfully taken a Python project based on Pygame and
converted it to PySDL2? From what I've read it seems like there are many
similarities since they're both SDL, but I don't know how much "other" work
Pygame is doing, and whether if I recreated any of that in Python it will
be fast enough?

Anyway, sorry I'm a bit all over the place. I wonder if anyone has any
thoughts to share?

Thanks,
Brian

-- 
*Brian Madden*
Mission Pinball (blog  | twitter
 | MPF software framework
 | sample games
)