diff --git a/crates/utils/src/record.rs b/crates/utils/src/record.rs index 916379f..b996cd0 100644 --- a/crates/utils/src/record.rs +++ b/crates/utils/src/record.rs @@ -18,6 +18,7 @@ pub fn record(app: &App, frame: &Frame) { // Capture all frames to a directory called `//nannou/simple_capture`. .join("recordings") .join(app.exe_name().unwrap()) + .join("frames") // Name each file after the number of the frame. .join(format!("{:03}", frame.nth())) // The extension will be PNG. We also support tiff, bmp, gif, jpeg, webp and some others. diff --git a/record.sh b/record.sh index 43d6dda..8d95db9 100755 --- a/record.sh +++ b/record.sh @@ -7,8 +7,9 @@ if [[ -z $1 ]]; then echo "example:" echo -e "\t$0 packagename" else - rm -rf "recordings/$1" + rm -rf "recordings/frames/$1" cargo run --release --package $1 -- -record - ffmpeg -framerate 60 -i "recordings/$1/%03d.png" -pix_fmt yuv420p "recordings/$1.mp4" + filename="video$(( $(find recordings/$1/videos -type f -exec basename -s .mp4 {} \; | sed 's/^video//' | sort -n | tail -n1) + 1)).mp4" + ffmpeg -framerate 60 -i "recordings/$1/frames/%03d.png" -pix_fmt yuv420p "recordings/$1/videos/$filename" echo "done" fi