Thanks! This looks usable.The following TKinter app using python3-vlc works on my Pi5:Code:
import tkinter as tkimport vlcclass myframe(tk.Frame): def __init__(self, root, width=500, height=400, bd=5): super(myframe, self).__init__(root) self.grid() self.frame = tk.Frame(self, width=450, height=350, bd=5) self.frame.configure(bg="black") self.frame.grid(row=0, column=0, columnspan=2, padx=8) self.play_button = tk.Button(self, text = 'Play', command = self.play) self.play_button.grid(row=1, column=0, columnspan=1, padx=8) self.stop_button = tk.Button(self, text = 'Pause', command = self.pause) self.stop_button.grid(row=1, column=1, columnspan=1, padx=8) def play(self): i = vlc.Instance('--no-xlib --quiet') self.player = i.media_player_new() #self.player.set_mrl('file:///home/pi/Downloads/Big_Buck_Bunny_1080_10s_30MB.mp4') self.player.set_mrl('rtsp://807e9439d5ca.entrypoint.cloud.wowza.com:1935/app-rC94792j/068b9c9a_stream2') xid = self.frame.winfo_id() self.player.set_xwindow(xid) self.player.play() def pause(self): try: self.player.pause() except: passif __name__ == '__main__': root = tk.Tk() root.title("Video Frame Tkinter") app = myframe(root) root.mainloop()
It seems that Tk library does not support Wayland but only X11 but it should be ok. Argument "--no-xlib" causes 100% CPU usage, it is below 10% without it.
Statistics: Posted by kolsi — Fri Feb 14, 2025 9:40 am