Video playback Raspbian Buster (Full) Raspberry PI4 2gb and 4gb

75 views
Skip to first unread message

Lee Goodman

unread,
May 8, 2020, 4:04:28 PM5/8/20
to pyglet-users
Hi guys very new to PYGLET and python, trying to piece together a script which is coming on very well other than video playback.

This is the sample code i have used

import pyglet
import youtube_dl

from pyglet.gl import *
glScalef(0.5, 0.5, 0.5)
#youtube play test===========================
#Youtube video download======================
output='spiderbath.mpg'

ydl_opts = {'outtmpl':output,'format':'134'}

#youtube_dl.YoutubeDL()
with youtube_dl.YoutubeDL(ydl_opts) as ydl:
   ydl.download([streampath])



#video playback=============================
MediaLoad = pyglet.media.load(output) 
player = pyglet.media.Player()
source = pyglet.media.StreamingSource()


window= pyglet.window.Window(1800,900)
player.queue(MediaLoad)
player.play()
print (player.source.video_format)

face_image = pyglet.image.load('clouda.png')
face = pyglet.sprite.Sprite(face_image, x=50, y=650)
animation = pyglet.image.load_animation('example-2.gif')
animSprite = pyglet.sprite.Sprite(animation)

w = animSprite.width
h = animSprite.height




 
@window.event
def on_draw():
    window.clear()
    if player.source and player.source.video_format:
        player.get_texture().blit(350,100)
    #animSprite.draw()
    face.draw()
@window.event
def on_close():
    print("close")
    player.pause()
    window.close()
@player.event   
def on_player_eos():
    print('end')
    window.close()
pyglet.app.run()

Ignore the sprites its the video playback that is having issues, im getting the following in the shell window before it dumps me out.

Backend terminated or disconnected.Fatal Python error: Bus error

Thread 0xaef1d460 (most recent call first):
  File "/usr/lib/python3/dist-packages/gi/overrides/GLib.py", line 498 in run
  File "/home/pi/.local/lib/python3.7/site-packages/pyglet/media/codecs/gstreamer.py", line 63 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 0xb6fdfad0 (most recent call first):
  File "/home/pi/.local/lib/python3.7/site-packages/pyglet/media/codecs/ffmpeg.py", line 950 in _ffmpeg_decode_video
  File "/home/pi/.local/lib/python3.7/site-packages/pyglet/media/codecs/ffmpeg.py", line 892 in _decode_video_packet
  File "/home/pi/.local/lib/python3.7/site-packages/pyglet/media/codecs/ffmpeg.py", line 963 in get_next_video_timestamp
  File "/home/pi/.local/lib/python3.7/site-packages/pyglet/media/player.py", line 460 in update_texture
  File "/home/pi/.local/lib/python3.7/site-packages/pyglet/clock.py", line 292 in call_scheduled_functions
  File "/home/pi/.local/lib/python3.7/site-packages/pyglet/app/base.py", line 237 in idle
  File "/home/pi/.local/lib/python3.7/site-packages/pyglet/app/base.py", line 167 in run
  File "/home/pi/.local/lib/python3.7/site-packages/pyglet/app/__init__.py", line 107 in run
  File "/home/pi/share/babymirror/youtube play.py", line 58 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.


I have installed Gstreamer v1.0 because I had issues with the media player not working at all but it at least plays sound now.

I assume (or hope) there is a package I havent installed, The script works on my pc as it should but as soon as I try the same script on either raspberry pi 4 (2gb and 4gb) I get the above error reports.

I would appreciate any help , this is a tiny part of a large script ive been writing over the last week, its for a project for my granddaughter.

The mistake I made was to write and test on my pc and not try on the pi before I prceeded any further DOH!.

Many thanks

Lee
Reply all
Reply to author
Forward
0 new messages