Hi Matthew, 

Using those libraries directly in pyglet might be difficult due to 
licensing differences, but it's an interesting first step to work out using 
them as external modules. Going forward, it will be better for pyglet to 
have its own direct wrapper. 

I would recommend looking over the pyglet.media.sources.Source and 
StreamingSource base classes, and looking at the avbin module for an 
example of how it can be subclassed. There are basically only a few methods 
needed for seeking, getting audio, and getting video packets. The hard 
work, of course, is working out how to fetch this data behind the scenes.



On Sunday, January 22, 2017 at 6:04:40 AM UTC+9, Matthew Macdonald-Wallace 
wrote:
>
> In fact, it gets better!
>
>
> https://bitbucket.org/proffalken/pyglet/commits/b051687f54654d2a3b4aaff3e93363a55a14a1b2?at=feature/additional_media_loader_support
>  
> uses PyAV and loads the video, now I just need to work out how to get it to 
> play!
>
> The following code will run without errors when using the above commit 
> installed into a virtualenv:
>
>
> ===================================
> import pyglet
>
> pyglet.options['debug_media'] = True
>
> window = pyglet.window.Window(width=800, height=600)
>
> label = pyglet.text.Label('Hello, world',
>                           font_name='Times New Roman',
>                           font_size=36,
>                           x=window.width//2, y=window.height//2,
>                           anchor_x='center', anchor_y='center')
>
>
> video = pyglet.media.load('../SampleVideo_1280x720_20mb.mp4')
>
> @window.event
> def on_draw():
>     window.clear()
>     label.draw()
>
> pyglet.app.run()
> ====================
>
> On Saturday, 21 January 2017 20:56:01 UTC, Matthew Macdonald-Wallace wrote:
>>
>> Hey,
>>
>> So I've been reading around and it looks like there are already a couple 
>> of options that we might be able to use:
>>
>> http://mikeboers.github.io/PyAV/index.html - basic functionality, need 
>> to play more but at least supports newer (3.x and above) versions of FFMPEG
>> https://avpy.readthedocs.io/en/stable/ - seems to contain everything we 
>> need, but doesn't support FFMPEG > 2.8 yet (see 
>> https://github.com/sydhds/Avpy/issues/1 for more on that!)
>>
>> I'll keep digging, but in the meantime these give me some hope! :)
>>
>> Matt
>>
>> On Friday, 20 January 2017 14:39:08 UTC, Benjamin Moran wrote:
>>>
>>> Hi Matthew, 
>>>
>>> I was the guy talking to you on Reddit earlier. This might be a pretty 
>>> gnarly thing to get into, but it's certainly a learning excercise! 
>>> The first step would be to familarize yourself with the ctypes library: 
>>> https://docs.python.org/3.5/library/ctypes.html
>>> I also found this video to be useful as an introduction: 
>>> https://www.youtube.com/watch?v=9CPOjOQNr7Y
>>>
>>> Avbin was pretty nice in that it offered a simple interface to work 
>>> with, but working with ffmpeg directly doesn't look to be terribly 
>>> difficult.
>>> I was looking over this guide to writing a simple video player in SDL 
>>> with the ffmpeg libs, and it looks pretty informative: 
>>> http://dranger.com/ffmpeg/tutorial01.html
>>>
>>>
>>> On Friday, January 20, 2017 at 8:24:19 PM UTC+9, Matthew 
>>> Macdonald-Wallace wrote:
>>>>
>>>> Hi all,
>>>>
>>>> I'm new to Pyglet and I need the ability to overlay text on top of 
>>>> video.  I've tried doing this with libavbin, however it appears that the 
>>>> avbin bindings are unmaintained (see previous posts by others to this 
>>>> group).
>>>>
>>>> I'm happy to explore what's involved in creating bindings for FFMpeg 
>>>> instead, as this seems to be included in pretty much all modern linux 
>>>> distros, however I've never written bindings before for anything, so if 
>>>> anyone is willing to help me do this that would be great.
>>>>
>>>> Work commitments mean that I probably won't be able to make a real 
>>>> start on this until mid-February, but if there's benefit in it for the 
>>>> community please let me know and send me links that might help me with 
>>>> background reading before I start on this!
>>>>
>>>> Cheers,
>>>>
>>>> Matt
>>>>
>>>

-- 
You received this message because you are subscribed to the Google Groups 
"pyglet-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/pyglet-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to