mirror of
git://f0xx.org/ac/ac-ms-media-transcode
synced 2026-07-29 07:38:26 +03:00
Add lab restream pipeline with pirate_drift logo and lib/env.sh.
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>
This commit is contained in:
42
bin/run.sh
Executable file
42
bin/run.sh
Executable file
@@ -0,0 +1,42 @@
|
||||
#!/usr/bin/env bash
|
||||
# Start encode-once + fanout-copy (two-stage pipeline from v0).
|
||||
set -euo pipefail
|
||||
|
||||
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
# shellcheck disable=SC1091
|
||||
source "${ROOT}/lib/common.sh"
|
||||
|
||||
SRC_ARG="${1:-1}"
|
||||
PID_ENCODE="${RUN_DIR}/encode.pid"
|
||||
PID_FANOUT="${RUN_DIR}/fanout.pid"
|
||||
LOG_RUN="${STORAGE_DIR}/run.log"
|
||||
|
||||
ensure_storage
|
||||
mkdir -p "${RUN_DIR}"
|
||||
|
||||
if [[ -f "${PID_ENCODE}" ]] && kill -0 "$(cat "${PID_ENCODE}")" 2>/dev/null; then
|
||||
die "pipeline already running (encode pid $(cat "${PID_ENCODE}")). use bin/stop.sh first"
|
||||
fi
|
||||
|
||||
chmod +x "${ROOT}/bin/"*.sh 2>/dev/null || true
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
source "${ROOT}/lib/outputs.sh"
|
||||
read_sinks
|
||||
|
||||
log "starting pipeline source=${SRC_ARG}"
|
||||
nohup "${ROOT}/bin/encode-once.sh" "${SRC_ARG}" >> "${LOG_RUN}" 2>&1 &
|
||||
echo $! > "${PID_ENCODE}"
|
||||
sleep 1
|
||||
|
||||
if [[ ${#SINKS[@]} -gt 0 ]]; then
|
||||
nohup "${ROOT}/bin/fanout-copy.sh" >> "${LOG_RUN}" 2>&1 &
|
||||
echo $! > "${PID_FANOUT}"
|
||||
log "fanout pid $(cat "${PID_FANOUT}")"
|
||||
else
|
||||
log "no RTMP sinks configured — fanout stage skipped"
|
||||
rm -f "${PID_FANOUT}" 2>/dev/null || true
|
||||
fi
|
||||
|
||||
log "encode pid $(cat "${PID_ENCODE}")"
|
||||
log "logs: ${LOG_RUN}, ${STORAGE_DIR}/encode.log, ${STORAGE_DIR}/fanout.log"
|
||||
Reference in New Issue
Block a user