This commit is contained in:
Tim
2026-04-05 21:24:05 +02:00
commit 922d00f52f
4 changed files with 59 additions and 0 deletions

32
stream-archive.sh Normal file
View File

@@ -0,0 +1,32 @@
#!/bin/sh
set -e
PUID=${PUID:-1000}
PGID=${PGID:-1000}
# Create group if GID doesn't exist
if ! getent group "$PGID" > /dev/null 2>&1; then
addgroup -g "$PGID" archivegroup
fi
GROUP_NAME=$(getent group "$PGID" | cut -d: -f1)
# Create user if UID doesn't exist
if ! getent passwd "$PUID" > /dev/null 2>&1; then
adduser -D -H -u "$PUID" -G "$GROUP_NAME" archiveuser
fi
chown "$PUID:$PGID" /output
echo "[stream-archive] Running as UID=${PUID} GID=${PGID}"
echo "[stream-archive] INPUT = ${INPUT}"
echo "[stream-archive] OUTPUT = ${OUTPUT}"
exec su-exec "$PUID:$PGID" ffmpeg \
-i "${INPUT}" \
-c copy \
-f segment \
-reset_timestamps 1 \
-segment_format mkv \
-segment_time 3600 \
-strftime 1 \
"${OUTPUT}"