From 2a9d47630eff8c1e08356b3213fa28e1217e7645 Mon Sep 17 00:00:00 2001 From: Paul Bailey Date: Thu, 5 Nov 2026 19:37:24 +0000 Subject: [PATCH] Trailer: encode standard-range yuv420p so Safari and QuickTime play it --- tools/trailer/make_trailer.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/trailer/make_trailer.sh b/tools/trailer/make_trailer.sh index 7ce4122..4daed26 100755 --- a/tools/trailer/make_trailer.sh +++ b/tools/trailer/make_trailer.sh @@ -23,12 +23,16 @@ fi D=$(ffprobe -v error -show_entries format=duration -of default=nw=1:nk=1 "$RAW") OUT_AT=$(echo "$D - 2.5" | bc) +# (Movie Maker records MJPEG in full-range yuvj420p: Safari and QuickTime +# won't play full-range H.264, so it's converted to standard-range yuv420p.) # A slow A-minor-ish drone, left and right a little apart, echoed and soft. PAD="0.06*(sin(2*PI*110*t)+0.7*sin(2*PI*164.8*t)+0.5*sin(2*PI*220*t)+0.35*sin(2*PI*261.6*t)*(0.5+0.5*sin(2*PI*0.08*t)))*(0.75+0.25*sin(2*PI*0.21*t))" PAD_R="0.06*(sin(2*PI*110.4*t)+0.7*sin(2*PI*165.2*t)+0.5*sin(2*PI*219.6*t)+0.35*sin(2*PI*262*t)*(0.5+0.5*cos(2*PI*0.08*t)))*(0.75+0.25*cos(2*PI*0.21*t))" 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]" -c:v libx264 -preset slow -crf 20 -pix_fmt yuv420p \ + -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: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