First functioning commit

This commit is contained in:
Skylar Grant 2024-06-25 20:06:35 -04:00
parent e5e7ed6823
commit aa10b1ea0d

37
timelapse/tl-process Executable file
View File

@ -0,0 +1,37 @@
#!/bin/bash
# Configuration Variables
SRC_DIR="/Volumes/media/tl/to-process/"
PROG_DIR="/Volumes/media/tl/in-progress/"
DONE_DIR="/Volumes/media/tl/processed/"
OUTPUT_DIR="/Volumes/media/tl/videos/"
# FFmpeg
FRAMERATE="30"
RESOLUTION="1920x1080"
# Other Variables
DATE=$(date +"%Y-%m-%d_%H-%M")
OUTPUT_FILE="${OUTPUT_DIR}${DATE}.mp4"
# Functions
process() {
echo "Moving images from ${SRC_DIR} to ${PROG_DIR}"
mv ${SRC_DIR}*.jpg ${PROG_DIR}
echo "Creating timelapse video from images in ${PROG_DIR}"
ffmpeg -framerate $FRAMERATE -pattern_type glob -i "${PROG_DIR}*.jpg" -s:v $RESOLUTION -c:v libx264 -pix_fmt yuv420p $OUTPUT_FILE
echo "Moving processed images to ${DONE_DIR}"
mv ${PROG_DIR}*.jpg ${DONE_DIR}
echo "Timelapse video created at ${OUTPUT_FILE}"
}
# Ensure directories exist
echo "Ensuring directories exist..."
mkdir -p $SRC_DIR $PROG_DIR $DONE_DIR $OUTPUT_DIR
# Run the process function
echo "Starting the timelapse creation process..."
process
echo "Process completed."