#!/usr/bin/env bash # # Batch render all 20 Week 1 Reels videos. # Usage: bash scripts/render-week1.sh [--concurrency N] # # Options: # --concurrency N Number of parallel renders (default: 2) # --ids ID1,ID2 Comma-separated list of specific IDs to render # set -euo pipefail CONCURRENCY=${1:-2} OUT_DIR="out/week1" mkdir -p "$OUT_DIR" IDS=( V03-H01 V10-H01 V03-H02 V10-H02 V03-H03 V17-H01 V17-H02 V06-H01 V08-H01 V05-LA-01 V05-NY-01 V05-TX-01 V05-CA-01 V08-LA-01 V04-H01 V20-H01 V14-H01 V04-H02 V02-H01 V19-H01 ) # Parse optional --ids flag if [[ "${1:-}" == "--ids" ]]; then IFS=',' read -ra IDS <<< "${2:-}" shift 2 fi TOTAL=${#IDS[@]} DONE=0 FAILED=0 echo "" echo "=== SportsTime Week 1 Batch Render ===" echo " Videos: $TOTAL" echo " Output: $OUT_DIR/" echo " Concurrency: $CONCURRENCY" echo "" render_one() { local id=$1 local out="$OUT_DIR/${id}.mp4" echo "[START] $id → $out" if npx remotion render "$id" "$out" --log=error 2>&1; then echo "[DONE] $id ✓" return 0 else echo "[FAIL] $id ✗" return 1 fi } export -f render_one export OUT_DIR # Run renders with controlled concurrency using xargs printf '%s\n' "${IDS[@]}" | xargs -P "$CONCURRENCY" -I {} bash -c 'render_one "$@"' _ {} echo "" echo "=== Render Complete ===" echo " Output: $OUT_DIR/" ls -lh "$OUT_DIR"/*.mp4 2>/dev/null || echo " (no .mp4 files found - check errors above)"