PyMKUI

repository·main·Indexed 41 days ago

https://github.com/zlmediakit/pymkui

A modern web management interface for ZLMediaKit integrated via a Python plugin mechanism. It provides tools for video stream management, pull stream proxying, server monitoring, recording management, and real-time video quality probing.

Tokens
973
Snippets
1
Records
4
Agent score
3%

What's inside PyMKUI

  1. PyMKUI Core Features Overview

    main

    PyMKUI provides a modern web management interface for ZLMediaKit with the following capabilities:

    • Video Stream Management: View, play, stop streams, and capture screenshots.
    • Pull Stream Proxy: Multi-backup addresses, on-demand/immediate modes, automatic failover, and online editing.
    • Protocol Conversion Presets: Save and load multiple sets of protocol conversion parameters.
    • Viewer List: Real-time monitoring of online viewers and connection info per stream.
    • Server Monitoring: Real-time charts for CPU, Memory, Disk, and Network.
    • Service Configuration: Online read/write of ZLMediaKit configuration items.
    • Online Streaming: Browser-based live streaming via WHIP protocol.
    • Network Connections: Manage all current TCP/UDP sessions.
    • Recording Management: File branching, date-based browsing, retrieval, playback, and auto-cleanup.
    • Plugin System: Extensible Python event hooks for custom authentication, recording callbacks, and stream notifications.
    • Video Quality Probe: Real-time sampling and analysis of bitrate, framerate, GOP, and audio-video interleaving via charts.
  2. Quick Start with Docker

    main

    PyMKUI is integrated into the ZLMediaKit Docker image. You can deploy it using a single command without manual configuration.

    After starting the container, access the web interface at http://<server_ip>/ and log in using the api.secret key.

    Port Mapping Reference

    PortProtocolPurpose
    80TCPHTTP (Frontend + API)
    443TCPHTTPS / WSS
    1935TCPRTMP
    554TCPRTSP
    10000TCP/UDPRTP
    8000UDPWebRTC
    9000UDPSRT
    docker run -id \
      -p 1935:1935 \
      -p 80:80 \
      -p 443:443 \
      -p 554:554 \
      -p 10000:10000 \
      -p 10000:10000/udp \
      -p 8000:8000/udp \
      -p 9000:9000/udp \
      zlmediakit/zlmediakit:master_py
  3. Manual Deployment via Source Code

    main

    If you are compiling ZLMediaKit yourself, follow these steps to integrate PyMKUI.

    1. Install Python Dependencies

    Requires Python 3.10+. Navigate to the backend directory and install requirements.

    Using Conda:

    conda create -n pymkui python=3.12 && conda activate pymkui
    pip install -r requirements.txt

    Using venv (Linux/Mac):

    python -m venv venv && source venv/bin/activate && pip install -r requirements.txt

    Using venv (Windows):

    python -m venv venv && venv\Scripts\activate && pip install -r requirements.txt

    2. Enable Python Support in ZLMediaKit

    Install the necessary system dependencies and recompile ZLMediaKit with the Python flag enabled.

    # Install system dependencies
    apt-get update && apt-get install -y python3 python3-dev python3-pip
    
    # Compile with Python support
    cmake .. -DENABLE_PYTHON=ON

    3. Configure config.ini

    Update your ZLMediaKit configuration to point to the PyMKUI plugin and frontend path.

    [python]
    plugin=mk_plugin
    
    [http]
    rootPath=/path/to/pymkui/frontend

    4. Set PYTHONPATH

    Ensure ZLMediaKit can locate the backend modules by adding the backend directory to your PYTHONPATH.

    Linux/Mac:

    export PYTHONPATH=/path/to/pymkui/backend:$PYTHONPATH

    Windows:

    set PYTHONPATH=C:\pymkui\backend;%PYTHONPATH%

    5. Verify Installation

    Start the MediaServer and check if the login page is accessible via curl.

    ./MediaServer
    curl -sv http://localhost:80/login.html
  4. Important: Database Management during Updates

    main

    PyMKUI is under rapid development and the database schema changes frequently. If you encounter database errors after updating the code, you must delete the existing database file to allow it to be rebuilt automatically on the next startup.

    Command to clear database:

    rm data/pymkui.db