关于树莓派4B使用pyglet播放视频报错的问题
最近我有个需求需要在树莓派上播放视频网上基本是两种,一个是cv2,一个是pyglet
我用cv2写的时候发现播放速度很难对得上(网上居然都是直接waitkey里面写死的时间……害人不浅)
改用pyglet模块,在windows上已经实现了,结果移到树莓派里面使用直接报错了。
我发现甚至最简单的pyglet播放视频程序也会报错……
就如下这么播放:
import pyglet
window = pyglet.window.Window()
player = pyglet.media.Player()
source = pyglet.media.load('E:\\FFOutput\\a5.mp4')
player.queue(source)
player.play()
@window.event
def on_draw():
image=player.get_texture()
if image is not None:
image.blit(0, 0)
pyglet.app.run()
报的错是BUS ERROR
>>> %Run test.py
Backend terminated or disconnected.Fatal Python error: Bus error
Thread 0xafd4f460 (most recent call first):
File "/usr/lib/python3/dist-packages/gi/overrides/GLib.py", line 498 in run
File "/usr/local/lib/python3.7/dist-packages/pyglet/media/codecs/gstreamer.py", line 66 in run
File "/usr/lib/python3.7/threading.py", line 917 in _bootstrap_inner
File "/usr/lib/python3.7/threading.py", line 885 in _bootstrap
Current thread 0xb6f1ead0 (most recent call first):
File "/usr/local/lib/python3.7/dist-packages/pyglet/media/codecs/ffmpeg.py", line 944 in _ffmpeg_decode_video
File "/usr/local/lib/python3.7/dist-packages/pyglet/media/codecs/ffmpeg.py", line 886 in _decode_video_packet
File "/usr/local/lib/python3.7/dist-packages/pyglet/media/codecs/ffmpeg.py", line 962 in get_next_video_timestamp
File "/usr/local/lib/python3.7/dist-packages/pyglet/media/player.py", line 463 in update_texture
File "/usr/local/lib/python3.7/dist-packages/pyglet/clock.py", line 292 in call_scheduled_functions
File "/usr/local/lib/python3.7/dist-packages/pyglet/app/base.py", line 239 in idle
File "/usr/local/lib/python3.7/dist-packages/pyglet/app/base.py", line 169 in run
File "/usr/local/lib/python3.7/dist-packages/pyglet/app/__init__.py", line 107 in run
File "/home/pi/python/test.py", line 14 in <module>
File "/usr/lib/python3/dist-packages/thonny/backend.py", line 1272 in _execute_prepared_user_code
File "/usr/lib/python3/dist-packages/thonny/backend.py", line 1200 in wrapper
File "/usr/lib/python3/dist-packages/thonny/backend.py", line 1213 in wrapper
File "/usr/lib/python3/dist-packages/thonny/backend.py", line 1259 in execute_source
File "/usr/lib/python3/dist-packages/thonny/backend.py", line 815 in _execute_source
File "/usr/lib/python3/dist-packages/thonny/backend.py", line 801 in _execute_file
File "/usr/lib/python3/dist-packages/thonny/backend.py", line 403 in _cmd_Run
File "/usr/lib/python3/dist-packages/thonny/backend.py", line 204 in handle_command
File "/usr/lib/python3/dist-packages/thonny/backend.py", line 146 in mainloop
File "/usr/lib/python3/dist-packages/thonny/backend_launcher.py", line 87 in <module> Use 'Stop/Restart' to restart.
请大佬们看一下怎么解决,使用的是树莓派4B,已经apt update upgrade过了
如果有其他正常播放视频的解决方案(需要全屏,并且能获取当前播放时间和调用方法,循环播放)也可以
第一次发帖,如果有哪里不对的地方请指出
推荐vlc播放器 yty 发表于 2021-12-30 19:01
推荐vlc播放器
今天尝试了一下vlc……就写了个时间跳转就报错了
player=vlc.MediaPlayer("XXXXX视频路径")
就如下这么写调用也会报错
player.set_time(1)
main decoder error: buffer deadlock prevented
在windows上运行正常,树莓派里各种报错
吐槽一下:怎么用啥啥报错= =,大佬们用树莓派的时候都是怎么开发的? TrinityLeaves 发表于 2021-12-31 16:26
今天尝试了一下vlc……就写了个时间跳转就报错了
player=vlc.MediaPlayer("XXXXX视频路径")
两个系统编码可能不太一致,而且跨平台一些模块的用法也不一样,建议开发都在linux中开发 yty 发表于 2022-1-4 09:29
两个系统编码可能不太一致,而且跨平台一些模块的用法也不一样,建议开发都在linux中开发
谢谢,不过我在Linux虚拟机和官方给的镜像做的虚拟机中运行都是正常的,实机上就会报错。
已经没用python写了,用C++和mplayer做了
页:
[1]