From c985b696eca8a94831637bf5a8ff488129f8db20 Mon Sep 17 00:00:00 2001 From: h7x4 Date: Sat, 14 Dec 2024 14:16:50 +0100 Subject: [PATCH] test_assets: add script to generate 30 sec of black frames --- .gitignore | 3 +++ flake.nix | 1 + setup_test_assets.sh | 21 +++++++++++++++++++++ test_assets/.gitkeep | 0 4 files changed, 25 insertions(+) create mode 100755 setup_test_assets.sh create mode 100644 test_assets/.gitkeep diff --git a/.gitignore b/.gitignore index a9d37c5..c09471f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,5 @@ target Cargo.lock + +test_assets/* +!test_assets/.gitkeep \ No newline at end of file diff --git a/flake.nix b/flake.nix index bb812c9..da47dd9 100644 --- a/flake.nix +++ b/flake.nix @@ -31,6 +31,7 @@ pkgs.mpv pkgs.grcov pkgs.cargo-nextest + pkgs.ffmpeg ]; RUST_SRC_PATH = "${toolchain.rust-src}/lib/rustlib/src/rust/library"; }); diff --git a/setup_test_assets.sh b/setup_test_assets.sh new file mode 100755 index 0000000..ca7d011 --- /dev/null +++ b/setup_test_assets.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash + +set -euo pipefail + +REQUIRED_COMMANDS=( + "git" + "ffmpeg" +) + +for cmd in "${REQUIRED_COMMANDS[@]}"; do + if ! command -v "$cmd" &> /dev/null; then + echo "Command '$cmd' not found. Please install it and try again." + exit 1 + fi +done + +ROOT_DIR=$(git rev-parse --show-toplevel) + +# Generate 30 seconds of 480p video with black background + +ffmpeg -f lavfi -i color=c=black:s=640x480:d=30 -c:v libx264 -t 30 -pix_fmt yuv420p "$ROOT_DIR/test_assets/black-background-30s-480p.mp4" \ No newline at end of file diff --git a/test_assets/.gitkeep b/test_assets/.gitkeep new file mode 100644 index 0000000..e69de29