mirror of
git://f0xx.org/ac/ac-ms-media-transcode
synced 2026-07-29 05:38:58 +03:00
Encode-once/fanout scripts, HLS output, and single overloadable env source. Commits assets/pirate_drift.png as default watermark for cluster runs. Co-authored-by: Cursor <cursoragent@cursor.com>
66 lines
2.2 KiB
Bash
66 lines
2.2 KiB
Bash
#!/usr/bin/env bash
|
|
# Single source of truth for pipeline variables.
|
|
# Override: export VAR=value before running, or set in config/local.env (sourced last).
|
|
#
|
|
# Requires ROOT (set by lib/common.sh before this file is sourced).
|
|
|
|
if [[ -z "${ROOT:-}" ]]; then
|
|
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
export ROOT
|
|
fi
|
|
|
|
# --- binaries ---
|
|
export FFMPEG_BIN="${FFMPEG_BIN:-ffmpeg}"
|
|
export FFPROBE_BIN="${FFPROBE_BIN:-ffprobe}"
|
|
export YTDLP_BIN="${YTDLP_BIN:-yt-dlp}"
|
|
|
|
# --- paths (logo default: assets/pirate_drift.png in repo root) ---
|
|
export LOGO_PATH="${LOGO_PATH:-${ROOT}/assets/pirate_drift.png}"
|
|
export PIPE_NAME="${PIPE_NAME:-.stream_pipe}"
|
|
export PIPE_PATH="${PIPE_PATH:-${ROOT}/${PIPE_NAME}}"
|
|
export PIPE_FIFO_SIZE="${PIPE_FIFO_SIZE:-1048576}"
|
|
export STORAGE_DIR="${STORAGE_DIR:-${ROOT}/storage}"
|
|
export RUN_DIR="${RUN_DIR:-${ROOT}/run}"
|
|
export SOURCES_LIST="${SOURCES_LIST:-${ROOT}/config/sources.list}"
|
|
export SINKS_LIST="${SINKS_LIST:-${ROOT}/config/sinks.list}"
|
|
export HLS_OUTPUT_DIR="${HLS_OUTPUT_DIR:-}"
|
|
|
|
# --- encode quality ---
|
|
export OUTPUT_PRESET="${OUTPUT_PRESET:-1080p}"
|
|
export FILTER_PROFILE="${FILTER_PROFILE:-default}"
|
|
export FPS="${FPS:-30}"
|
|
export THREADS="${THREADS:-8}"
|
|
export THREAD_QUEUE_SIZE="${THREAD_QUEUE_SIZE:-512}"
|
|
export RECORD_FORMAT="${RECORD_FORMAT:-mkv}"
|
|
|
|
# --- ingest behaviour ---
|
|
export YTDLP_ENABLED="${YTDLP_ENABLED:-1}"
|
|
export NEAR_REALTIME="${NEAR_REALTIME:-1}"
|
|
export FANOUT_RETRIES="${FANOUT_RETRIES:-5}"
|
|
|
|
# optional delogo rectangle (source coords): x:y:w:h
|
|
export DELOGO="${DELOGO:-}"
|
|
|
|
# separate audio when video track has no audio
|
|
export AUDIO_SOURCE="${AUDIO_SOURCE:-}"
|
|
|
|
# --- optional file overrides (highest priority among defaults) ---
|
|
_mp_load_env_file() {
|
|
local f="$1"
|
|
if [[ -f "${f}" ]]; then
|
|
set -a
|
|
# shellcheck disable=SC1090
|
|
source "${f}"
|
|
set +a
|
|
fi
|
|
}
|
|
_mp_load_env_file "${ROOT}/config/local.env"
|
|
|
|
# Re-apply path defaults if local.env used relative paths
|
|
export LOGO_PATH="${LOGO_PATH:-${ROOT}/assets/pirate_drift.png}"
|
|
export PIPE_PATH="${PIPE_PATH:-${ROOT}/${PIPE_NAME}}"
|
|
export STORAGE_DIR="${STORAGE_DIR:-${ROOT}/storage}"
|
|
export RUN_DIR="${RUN_DIR:-${ROOT}/run}"
|
|
export SOURCES_LIST="${SOURCES_LIST:-${ROOT}/config/sources.list}"
|
|
export SINKS_LIST="${SINKS_LIST:-${ROOT}/config/sinks.list}"
|