Files
vid-repair/scripts/generate_fixtures.sh

23 lines
893 B
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
OUT_DIR="$ROOT_DIR/tests/fixtures/generated"
mkdir -p "$OUT_DIR"
ffmpeg -y -hide_banner -loglevel error -f lavfi -i testsrc=size=128x72:rate=30 -f lavfi -i sine=frequency=1000:sample_rate=44100 -t 1 -c:v libx264 -pix_fmt yuv420p -c:a aac -movflags +faststart "$OUT_DIR/clean.mp4"
ffmpeg -y -hide_banner -loglevel error -f lavfi -i testsrc=size=128x72:rate=30 -f lavfi -i sine=frequency=1000:sample_rate=44100 -t 1 -c:v libx264 -pix_fmt yuv420p -c:a aac "$OUT_DIR/no_faststart.mp4"
# Create a truncated file to simulate partial download/corruption
cp "$OUT_DIR/clean.mp4" "$OUT_DIR/truncated.mp4"
python3 - <<'PY'
import os
path = "${OUT_DIR}/truncated.mp4"
size = os.path.getsize(path)
with open(path, "r+b") as f:
f.truncate(max(0, size - 2048))
PY
echo "Fixtures written to $OUT_DIR"