Skip to content

Klrohias/swiftstream

Repository files navigation

SwiftStream 🚀

English | 简体中文

Project Overview

SwiftStream is a high-performance HLS (m3u8) streaming accelerator written in Rust. It acts as a local proxy that caches and prefetches media segments to enable faster playback in local media players.

Key Features

  • 🚀 Accelerates HLS/m3u8 streaming playback
  • 📦 Local caching of TS segments
  • ⚡ Low-latency proxy server
  • 📊 Configurable cache settings

Usage

Run with Docker
  1. Write your docker-compose.yml

    services:
      swiftstream:
        image: ghcr.io/klrohias/swiftstream:latest
        container_name: swiftstream
        restart: always
        ports:
          - <your_expose_port>:<port_in_listenAddr>
        network_mode: bridge
        volumes:
          - /path/to/config.yml:/config.yml
  2. Configuration

    See Configuration

    NOTE: Normally, port in baseUrl should be same as the expose port

  3. Run

    docker compose up -d
Build and run
  1. Clone and build

    git clone https://github.com/your-repo/swiftstream-rs.git
    cd swiftstream-rs
    cargo build --release
  2. Configuration

    See Configuration

  3. Run

    ./target/release/swiftstream
Use in your player
  1. For channels list

    {baseUrl}/playlist?origin={originUrl}
    

    Example:

    http://127.0.0.1:11451/playlist?origin=http://some-website.com/my-tv-program-list.m3u8
    
  2. For a single HLS stream

    {baseUrl}/media?origin={originUrl}
    

    Example:

    http://127.0.0.1:11451/media?origin=http://some-website.com/stream-such-as-BBC.m3u8
    

Configuration

The program defaults to reading the configuration from config.yml. If you need to customize the configuration file path, please use the SS_CONFIG_PATH environment variable.

See config template config.example.yml.