svensk-ugc-factory-demo / fixtures /make_fixtures.sh
afa67's picture
deploy dry-run demo
257a670 verified
Raw
History Blame
992 Bytes
#!/usr/bin/env bash
# Build the QC golden fixtures (SPEC §7.3): a clip with KNOWN Swedish speech.
# Uses the macOS Swedish TTS voice (Alva) so the spoken words are ground truth.
# The same clip is the "good" case (expected text == spoken text) and the "bad"
# case (expected text deliberately wrong) — see fixtures/golden.json.
#
# Output: fixtures/good_clip.mp4 — 8.0s, 1080x1920 (9:16), H.264 + AAC.
set -euo pipefail
cd "$(dirname "$0")"
TEXT="$(python3 -c "import json; print(json.load(open('golden.json'))['good']['spoken_text'])")"
say -v Alva -o speech.aiff "$TEXT"
# Pad/trim audio to exactly 8s, render onto a solid 9:16 video canvas.
ffmpeg -y -v error \
-f lavfi -i "color=c=0x224466:s=1080x1920:d=8:r=25" \
-i speech.aiff \
-af "adelay=400|400,apad" -t 8 \
-c:v libx264 -pix_fmt yuv420p -c:a aac -shortest \
good_clip.mp4
rm -f speech.aiff
echo "wrote $(pwd)/good_clip.mp4 ($(ffprobe -v error -show_entries format=duration -of default=nw=1:nk=1 good_clip.mp4)s)"