Init
This commit is contained in:
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
*.env
|
||||||
13
Dockerfile
Normal file
13
Dockerfile
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
FROM jrottenberg/ffmpeg:7.1.1-alpine320
|
||||||
|
|
||||||
|
# no glibc
|
||||||
|
RUN apk add --no-cache su-exec
|
||||||
|
|
||||||
|
RUN mkdir -p /output
|
||||||
|
|
||||||
|
COPY stream-archive.sh /stream-archive.sh
|
||||||
|
RUN chmod +x /stream-archive.sh
|
||||||
|
|
||||||
|
VOLUME ["/output"]
|
||||||
|
|
||||||
|
ENTRYPOINT ["/stream-archive.sh"]
|
||||||
13
compose.yaml
Normal file
13
compose.yaml
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
services:
|
||||||
|
ffmpeg-archive:
|
||||||
|
build: .
|
||||||
|
container_name: ffmpeg-archive
|
||||||
|
environment:
|
||||||
|
- INPUT=${INPUT:-rtsp://your-stream-url}
|
||||||
|
# uses strftime for naming
|
||||||
|
- OUTPUT=${OUTPUT:-/output/%Y-%m-%d_%H-%M-%S.mkv}
|
||||||
|
- PUID=${PUID:-1000}
|
||||||
|
- PGID=${PGID:-1000}
|
||||||
|
volumes:
|
||||||
|
- ${RECORDINGS_DIR:-./recordings}:/output
|
||||||
|
restart: unless-stopped
|
||||||
32
stream-archive.sh
Normal file
32
stream-archive.sh
Normal 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}"
|
||||||
Reference in New Issue
Block a user