diff --git a/tools/site/make_site.sh b/tools/site/make_site.sh index 67bbc95..c799d8e 100755 --- a/tools/site/make_site.sh +++ b/tools/site/make_site.sh @@ -52,3 +52,12 @@ DATA=build/site_data.json || { echo "couldn't dump the game data for the guide"; exit 1; } python3 tools/site/make_guide.py "$DATA" build/site || exit 1 rm -f "$DATA" + +# Cloudflare Pages refuses any file over 25 MiB: catch it here, not at deploy. +LIMIT=26214400 +for f in build/site/*; do + s=$(stat -f %z "$f" 2>/dev/null || stat -c %s "$f") + if [ "$s" -ge "$LIMIT" ]; then + echo "$f is $s bytes: over Cloudflare Pages' 25 MiB limit (re-encode the trailer smaller)"; exit 1 + fi +done diff --git a/tools/trailer/make_trailer.sh b/tools/trailer/make_trailer.sh index 4daed26..fe95ce5 100755 --- a/tools/trailer/make_trailer.sh +++ b/tools/trailer/make_trailer.sh @@ -32,7 +32,7 @@ ffmpeg -v error -y -i "$RAW" -f lavfi -i "aevalsrc='$PAD|$PAD_R':s=48000:d=$D" \ -filter_complex "[1:a]lowpass=f=1800,aecho=0.8:0.7:180|340:0.35|0.25,afade=t=in:d=2.5,afade=t=out:st=$OUT_AT:d=2.5[m];[0:a]volume=0.8[g];[g][m]amix=inputs=2:duration=first:normalize=0[a]" \ -map 0:v -map "[a]" -vf "scale=in_range=pc:out_range=tv,format=yuv420p" -color_range tv \ -colorspace bt709 -color_primaries bt709 -color_trc bt709 \ - -c:v libx264 -profile:v high -level 4.0 -preset slow -crf 20 -tag:v avc1 \ + -c:v libx264 -profile:v high -level 4.0 -preset slow -crf 23 -maxrate 3500k -bufsize 7000k -tag:v avc1 \ -c:a aac -b:a 160k -movflags +faststart "$OUT" || exit 1 # The title, for the download page's poster. ffmpeg -v error -y -ss 4.5 -i "$OUT" -frames:v 1 -q:v 3 build/trailer/poster.jpg