mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-05-01 19:17:41 +03:00
33 lines
1.1 KiB
Plaintext
33 lines
1.1 KiB
Plaintext
#!/command/with-contenv bash
|
|
# shellcheck shell=bash
|
|
# Start the transcode proxy (in-process with Frigate container)
|
|
|
|
set -o errexit -o nounset -o pipefail
|
|
|
|
# Logs should be sent to stdout so that s6 can collect them
|
|
|
|
echo "[INFO] Starting transcode proxy..."
|
|
|
|
# Default upstream to nginx internal port when not set
|
|
export TRANSCODE_PROXY_UPSTREAM="${TRANSCODE_PROXY_UPSTREAM:-http://127.0.0.1:5000}"
|
|
|
|
# Use Frigate's FFmpeg when not set
|
|
if [ -z "${TRANSCODE_PROXY_FFMPEG:-}" ]; then
|
|
export TRANSCODE_PROXY_FFMPEG="$(python3 /usr/local/ffmpeg/get_ffmpeg_path.py)"
|
|
fi
|
|
|
|
# Wait for nginx/API to be ready so proxy can reach upstream
|
|
until curl -sf -o /dev/null "${TRANSCODE_PROXY_UPSTREAM}/api/version"; do
|
|
echo "[INFO] Waiting for upstream ${TRANSCODE_PROXY_UPSTREAM}..."
|
|
sleep 1
|
|
done
|
|
|
|
echo "[INFO] Upstream ready, starting transcode proxy on port ${TRANSCODE_PROXY_PORT:-5010}"
|
|
|
|
export PYTHONPATH="/opt/frigate:${PYTHONPATH:-}"
|
|
|
|
exec 2>&1
|
|
exec python3 -m uvicorn transcode_proxy.main:app \
|
|
--host "${TRANSCODE_PROXY_HOST:-0.0.0.0}" \
|
|
--port "${TRANSCODE_PROXY_PORT:-5010}"
|