Files
linearvoid/scripts/normalize.sh
T
zwitschi 5b5cdc4cd8
CI / test (push) Successful in 9m11s
CI / docker (push) Failing after 2m39s
CI / release (push) Skipped
Release / release (push) Canceled after 2m11s
chore: release v1.0.7
Playout: slate fallback, strict ffprobe validation, Prometheus metrics
Chat: history on join, DM offline delivery, env-config rate limits,
  Redis auto-reconnect, heartbeat, ban/mute enforcement, DM metrics
Viewer: presence indicators, schedule overlay, public /api/schedule
Admin: playlist drag-reorder, schedule overrides CRUD, user actions,
  inline mod buttons, CSV export, config editor, restart buttons,
  upload normalization gate, analytics time range
nginx: CORS preflight, JSON health, stub_status
Docs: test-lab vs production distinction across all configs/docs
Infra: Redis maxmemory, CD health IP-agnostic, slate volume mount
2026-08-06 17:41:52 +02:00

58 lines
1.7 KiB
Bash

#!/bin/bash
# Normalize video to Linear Void required profile.
# Output: H.264/AAC, 30fps constant, 2s keyframes, yuv420p, 48kHz audio.
# Usage: ./normalize.sh <input> [output]
set -e
INPUT="$1"
if [ -z "$INPUT" ]; then
echo "Usage: $0 <input-file> [output-file]"
echo " Normalizes video to Linear Void profile: H.264/AAC, 30fps, 2s keyframes"
exit 1
fi
if [ ! -f "$INPUT" ]; then
echo "Error: input file not found: $INPUT"
exit 1
fi
OUTPUT="${2:-${INPUT%.*}-normalized.mp4}"
CRF="${NORMALIZE_CRF:-21}"
PRESET="${NORMALIZE_PRESET:-medium}"
AUDIO_BITRATE="${NORMALIZE_AUDIO_BITRATE:-160k}"
echo "=== Linear Void Video Normalization ==="
echo " Input: $INPUT ($(du -h "$INPUT" | cut -f1))"
echo " Output: $OUTPUT"
echo " CRF: $CRF"
echo " Preset: $PRESET"
echo " Audio rate: $AUDIO_BITRATE"
echo ""
# Probe input
echo "--- Input Properties ---"
ffprobe -v error -show_entries stream=codec_name,width,height,r_frame_rate,pix_fmt,sample_rate,channels \
-of default=noprint_wrappers=1 "$INPUT" 2>&1
echo ""
# Normalize
echo "--- Normalizing ---"
ffmpeg -y -i "$INPUT" \
-c:v libx264 -preset "$PRESET" -crf "$CRF" \
-r 30 -g 60 -keyint_min 60 -sc_threshold 0 \
-pix_fmt yuv420p \
-c:a aac -b:a "$AUDIO_BITRATE" -ar 48000 -ac 2 \
-movflags +faststart \
"$OUTPUT"
echo ""
echo "--- Output Properties ---"
ffprobe -v error -show_entries stream=codec_name,width,height,r_frame_rate,pix_fmt,sample_rate,channels \
-of default=noprint_wrappers=1 "$OUTPUT" 2>&1
echo ""
echo "=== Normalization Complete ==="
echo " Output: $OUTPUT ($(du -h "$OUTPUT" | cut -f1))"
echo ""
echo "Verify with: ffprobe -v error -show_entries stream=codec_name,r_frame_rate,pix_fmt -of default=noprint_wrappers=1 $OUTPUT"