用python3.7在Raspberry PI 3B上播放视频

2024-09-26 18:11:50 发布

您现在位置:Python中文网/ 问答频道 /正文

如何使用python3.7在Raspberry Pi 3b上播放视频?我试过下面的代码,这在桌面上工作,但在pi上它给了我一个神秘的“总线错误”问题。尝试使用try-catch块打印更多信息,但没有打印任何内容

import pyglet
import traceback

pyglet.have_avbin = True
pyglet.options['search_local_libs'] = True
vidPath = "sample1.mp4"
exc_obj=None
window = pyglet.window.Window(width=500, height=500)

player = pyglet.media.Player()

player.volume = 0
source = pyglet.media.StreamingSource()
try:
    mediaLoad = pyglet.media.load(vidPath)


    player.queue(mediaLoad)

    player.play()
except Exception as exc:
     tb = traceback.TracebackException.from_exception(exc)
     print(''.join(tb.stack.format()))



@window.event
def on_draw():
    if player.source and player.source.video_format:
        player.get_texture().blit(0, 0)


pyglet.app.run()

是否有其他库可以用来实现相同的或任何其他方式来修复此错误。 如果需要,我可以将硬件更改为3b+或4。你知道吗


Tags: importtrueformatsource错误windowmediatb

热门问题