#!/usr/bin/env bash
# Makes two test videos from a speech file (episode.wav) joined from 29 LibriSpeech utterances; the joining script and the audio are not published: talk.mp4 (a plain colour card plus the speech) and silent.mp4 (20 s of picture, no audio track).
# Usage: bash make-clips.sh <episode.wav> <outdir>
set -euo pipefail
wav=${1:?episode.wav}; out=${2:?outdir}; mkdir -p "$out"
[ -s "$wav" ] || { echo "FAIL $wav is missing or empty" >&2; exit 1; }
ffmpeg -v error -y -f lavfi -i color=c=0x1f3a5f:s=1280x720:r=25 -i "$wav" -shortest -c:v libx264 -pix_fmt yuv420p -c:a aac "$out/talk.mp4"
ffmpeg -v error -y -f lavfi -i color=c=0x1f3a5f:s=1280x720:r=25 -t 20 -c:v libx264 -pix_fmt yuv420p -an "$out/silent.mp4"
for f in talk silent; do echo "$f: $(ffprobe -v error -show_entries stream=codec_type,duration -of csv=p=0 "$out/$f.mp4" | tr "\n" " ")"; done
