update recording.sh

main
annieversary 2021-08-21 17:59:46 +02:00
parent 6e73e65dfc
commit ca5e405a7e
2 changed files with 4 additions and 2 deletions

View File

@ -18,6 +18,7 @@ pub fn record(app: &App, frame: &Frame) {
// Capture all frames to a directory called `/<path_to_nannou>/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.

View File

@ -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