network-streaming-player.py

Raspberry Pi Smart Display Module · File : network-streaming-player.py · Language : Python · Use case : Lire un flux vidéo 4K depuis le réseau et l'afficher sur le panneau SDM.

Python script using MPV to play a network video stream in 4K on the screen connected to the Smart Display Module.

Requires Raspberry Pi OS with H.264/HEVC codecs installed and the SDM panel configured as video output. Install mpv via apt. The module handles power and video via the SDM connector. Run the script in graphical mode or via X11/Wayland configured for the panel.

network-streaming-player.py

import subprocess
import sys

# Utilise VLC ou mpv pour la lecture réseau
# Assurez-vous que le panneau SDM est reconnu comme sortie video HDMI/DSI
STREAM_URL = "http://192.168.1.100/video/stream.mp4"

def play_stream(url):
    cmd = [
        'mpv',
        '--no-terminal',
        '--fullscreen',
        '--hwdec=auto', # Accélération matérielle si dispo
        '--vid=1',
        '--aid=1',
        url
    ]
    print(f"Démarrage du flux: {url}")
    try:
        subprocess.run(cmd, check=True)
    except subprocess.CalledProcessError:
        print("Erreur de lecture. Vérifiez l'URL et les codecs.")
    except KeyboardInterrupt:
        print("Arrêt manuel.")

if __name__ == '__main__':
    play_stream(STREAM_URL)

← Back to the board