embystream 0.0.15

Another Emby streaming application (frontend/backend separation) written in Rust.
Documentation
# Application Configuration File
# All values in this file are case-sensitive

[Log]
# Sets the application's logging verbosity.
# Available options (from least to most verbose): "error", "warn", "info", "debug", "trace"
level = "info"

# The prefix of log files
# Returns a date string formatted as "prefix-YYYY-MM-DD" if a prefix is provided (e.g., "myapp-2025-07-28"),
# otherwise defaults to "YYYY-MM-DD".
prefix = ""

# Specifies the directory where log files will be stored.
root_path = "/mnt/stream/logs"

[General]
# Memory usage profile (options: "low", "middle", "high")
# - low: Minimal memory usage, reduced performance
# - middle: Balanced memory and performance (recommended)
# - high: Maximum performance, higher memory usage
memory_mode = "middle"

# Stream running mode
# - Options: "frontend", "backend", "dual"
# - "frontend": Runs only the frontend service.
# - "backend": Runs only the backend service.
# - "dual": Runs both frontend and backend services.
# - Default: "frontend"
stream_mode = "frontend"

# Backend type for media streaming (options: "disk", "direct_link", "openlist")
backend_type = "disk"

# Encryption key for secure communications (6-16 bytes)
# WARNING: Change this from the default value in production
encipher_key = "change_this_to_a_secure_key"

# Encryption iv for secure communications (6-16 bytes)
# WARNING: Change this from the default value in production
encipher_iv = "change_this_to_a_secure_iv"

[Emby]
# Emby server configuration

# Base URL of your Emby server
url = "http://127.0.0.1"

# Port for Emby server
port = "8096"

# API key for Emby (leave empty if not using)
token = ""

[Transcode]
# Defines the working directory for temporary storage of transcoded video segments.
root_path = "/Users/hsuyelin/Downloads/embystream/transcode"

[UserAgent]
# UserAgent filtering mode (options: "allow", "deny", "none")
mode = "allow"

# List of allowed User-Agents (used when mode = "allow")
# Example: allow_ua = ["Mozilla/5.0", "AppleWebKit"]
allow_ua = []

# List of denied User-Agents (used when mode = "deny")
# Example: deny_ua = ["curl/7.68.0", "wget"]
deny_ua = []

[Http2]
# Path to SSL/TLS certificate file (PEM format)
# Required for HTTPS/HTTP2 connections
# Example: ssl_cert_file = "/path/to/certificate.pem"
ssl_cert_file = "ssl.cer"

# Path to SSL/TLS private key file (PEM format)
# Required for HTTPS/HTTP2 connections
# Example: ssl_key_file = "/path/to/private_key.pem"
ssl_key_file = "ssl.key"

[Fallback]
# The path to a fallback video file to play when the original video is missing.
# If this path is set and the file exists, this video will be played instead of showing an error.
# Note: For binary or Docker deployments in 'dual' or 'frontend' mode, this path must be accessible
# from within the server or container for this feature to function.
# Example: "/path/to/your/video_missing.mp4"
video_missing_path = ""

[Frontend]
# Frontend web server configuration
listen_port = 60001             # Port for the frontend web interface
check_file_existence = true	    # Check if the file exists on the frontend before redirect to the backend (default: true).

# ===================================================================
# Frontend Path Rewrite Rules
# ===================================================================
#
# You can define one or more rewrite rules for incoming request paths.
# Rules are processed sequentially in the order they appear in this file.
# The first rule that matches a path will be applied, giving topmost rules the highest priority.
#
# Each rule must be defined in a separate [[Frontend.PathRewrite]] block.
# To add a new rule, simply copy an entire [[...]] block below, paste it
# at the end, and modify its values.
#
# --- Rule 1: Example - Proxy all requests to a CDN ---
# Description: Rewrites a path like "/path/video.mp4" to "https://my-cdn.com/path/video.mp4"
[[Frontend.PathRewrite]]
enable = false                 # Set to true to enable this rule.
pattern = "^(/.*)$"            # The regex pattern to search for.
replacement = "https://my-cdn.com$1" # The replacement string. Use $1 for the first captured group.

# --- Rule 2: Example - Remove a specific base path ---
# Description: Rewrites "/media/movies/video.mp4" to "/movies/video.mp4".
# Note: This rule is currently disabled (enable = false).
[[Frontend.PathRewrite]]
enable = false
pattern = "^/media(/.*)$"
replacement = "$1"

# --- Rule 3: Example - Map one API path to another ---
# Description: Rewrites "/stream/file.mkv" to "/proxy/file.mkv".
[[Frontend.PathRewrite]]
enable = false
pattern = "^/stream(/.*)$"
replacement = "/proxy$1"

# Backend-specific configurations
# Only configure the section matching your chosen backend_type

[Backend]
# Backend server configuration
listen_port = 60002                                    # Port for the stream service
base_url = "https://example.com"                       # Base URL for stream service
path = "stream"                                        # Path component for stream URLs
port = "443"                                           # HTTPS port for stream service
proxy_mode = "proxy"                                   # Backend proxy mode for media streaming (options: "proxy", "redirect")
client_speed_limit_kbs = 15360                         # Client speed limit in KB/s (integer >= 0). 0 = unlimited.
client_burst_speed_kbs = 20480                         # Client burst speed in KB/s (integer >= 0). 0 = unlimited.
# Speed Limit Notes:
# 1. These settings are only effective when `backend_type` is "disk" and `proxy_mode` is "proxy".
#    They do not apply to 302 redirects to CDNs or other remote servers.
# 2. `client_burst_speed_kbs` must be greater than or equal to `client_speed_limit_kbs`.
# 3. If `client_burst_speed_kbs` is less than `client_speed_limit_kbs` (and the limit is > 0),
#    it will automatically default to 1.2 times `client_speed_limit_kbs`.

# List of problematic clients that do not send Range headers.
# EmbyStream will apply a workaround for these clients.
# Default built-in clients are: ["yamby", "hills", "embytolocalplayer"]
problematic_clients = []

# ===================================================================
# Backend Path Rewrite Rules
# ===================================================================
#
# You can define one or more rewrite rules for incoming request paths.
# Rules are processed sequentially in the order they appear in this file.
# The first rule that matches a path will be applied, giving topmost rules the highest priority.
#
# Each rule must be defined in a separate [[Backend.PathRewrite]] block.
# To add a new rule, simply copy an entire [[...]] block below, paste it
# at the end, and modify its values.
#
# --- Rule 1: Example - Proxy all requests to a CDN ---
# Description: Rewrites a path like "/path/video.mp4" to "https://my-cdn.com/path/video.mp4"
[[Backend.PathRewrite]]
enable = false                 # Set to true to enable this rule.
pattern = "^(/.*)$"            # The regex pattern to search for.
replacement = "https://my-cdn.com$1" # The replacement string. Use $1 for the first captured group.

# --- Rule 2: Example - Remove a specific base path ---
# Description: Rewrites "/media/movies/video.mp4" to "/movies/video.mp4".
# Note: This rule is currently disabled (enable = false).
[[Backend.PathRewrite]]
enable = false
pattern = "^/media(/.*)$"
replacement = "$1"

# --- Rule 3: Example - Map one API path to another ---
# Description: Rewrites "/stream/file.mkv" to "/proxy/file.mkv".
[[Backend.PathRewrite]]
enable = false
pattern = "^/stream(/.*)$"
replacement = "/proxy$1"

[Disk]
# Disk backend configuration - for local or mounted storage
description = ""

[OpenList]
# OpenList backend configuration
base_url = "https://openlist.example.com" # OpenList server URL
port = "443"                             # OpenList server port
token = ""                               # Authentication token for OpenList

[DirectLink]
# DirectLink backend configuration - for CDN or direct streaming
user_agent = ""                         # Custom User-Agent for requests