Expand fixture generator
This commit is contained in:
@@ -8,15 +8,45 @@ 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 -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"
|
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"
|
||||||
|
ffmpeg -y -hide_banner -loglevel error -f lavfi -i testsrc=size=128x72:rate=30 -t 1 -c:v libx264 -pix_fmt yuv420p "$OUT_DIR/video_only.mp4"
|
||||||
|
ffmpeg -y -hide_banner -loglevel error -f lavfi -i sine=frequency=1000:sample_rate=44100 -t 1 -c:a aac "$OUT_DIR/audio_only.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/clean.mkv"
|
||||||
|
|
||||||
# Create a truncated file to simulate partial download/corruption
|
# Create a truncated file to simulate partial download/corruption
|
||||||
cp "$OUT_DIR/clean.mp4" "$OUT_DIR/truncated.mp4"
|
cp "$OUT_DIR/clean.mp4" "$OUT_DIR/truncated.mp4"
|
||||||
python3 - <<'PY'
|
python3 - <<PY
|
||||||
import os
|
import os
|
||||||
path = "${OUT_DIR}/truncated.mp4"
|
path = "$OUT_DIR/truncated.mp4"
|
||||||
size = os.path.getsize(path)
|
size = os.path.getsize(path)
|
||||||
with open(path, "r+b") as f:
|
with open(path, "r+b") as f:
|
||||||
f.truncate(max(0, size - 2048))
|
f.truncate(max(0, size - 2048))
|
||||||
PY
|
PY
|
||||||
|
|
||||||
|
# Heavier truncation for more pronounced errors
|
||||||
|
cp "$OUT_DIR/clean.mp4" "$OUT_DIR/truncated_hard.mp4"
|
||||||
|
python3 - <<PY
|
||||||
|
import os
|
||||||
|
path = "$OUT_DIR/truncated_hard.mp4"
|
||||||
|
size = os.path.getsize(path)
|
||||||
|
with open(path, "r+b") as f:
|
||||||
|
f.truncate(max(0, size // 2))
|
||||||
|
PY
|
||||||
|
|
||||||
|
# Corrupt bytes in the middle of the file
|
||||||
|
cp "$OUT_DIR/clean.mp4" "$OUT_DIR/corrupt_mid.mp4"
|
||||||
|
python3 - <<PY
|
||||||
|
import os
|
||||||
|
path = "$OUT_DIR/corrupt_mid.mp4"
|
||||||
|
with open(path, "r+b") as f:
|
||||||
|
f.seek(0, os.SEEK_END)
|
||||||
|
size = f.tell()
|
||||||
|
if size > 4096:
|
||||||
|
f.seek(size // 2)
|
||||||
|
chunk = bytearray(f.read(1024))
|
||||||
|
for i in range(len(chunk)):
|
||||||
|
chunk[i] ^= 0xFF
|
||||||
|
f.seek(size // 2)
|
||||||
|
f.write(chunk)
|
||||||
|
PY
|
||||||
|
|
||||||
echo "Fixtures written to $OUT_DIR"
|
echo "Fixtures written to $OUT_DIR"
|
||||||
|
|||||||
Reference in New Issue
Block a user