Last active
June 10, 2018 19:49
-
-
Save andyseubert/ebc96cf5767dc0a41eb25911184f8b06 to your computer and use it in GitHub Desktop.
WYZE Cam copy files from webcam SD locally mounted and concatenate the videos
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#get yesterday's date formatted | |
YSTRDT=$(date -v-1d +%Y%m%d) | |
CAMNAME="FRONT" | |
STARTFOLDER="/Volumes/Untitled/record" | |
for DAYDIR in $(find $STARTFOLDER/ -type d -maxdepth 1 -name '20*') | |
do | |
OUTFILEDIR="/Users/andys/movies/$CAMNAME/" | |
OUTFILEBASE=$(basename $DAYDIR) | |
OUTFILENAME="$OUTFILEDIR$OUTFILEBASE.mp4" | |
echo "output filename $OUTFILENAME" | |
if [ ! -f $OUTFILENAME ]; then | |
FILESFILE="/tmp/wyzeFiles.txt" | |
rm -f $FILESFILE | |
echo -n "Finding candidate files .." | |
FILELIST=$(find "$DAYDIR" -type f -name '*.mp4') | |
echo ".. "$(echo -e "$FILELIST" | wc -l)" found" | |
for filename in $(echo -e "$FILELIST" | sort -V) | |
do | |
echo "file $filename'" >> $FILESFILE | |
done | |
echo "running FFMPEG" | |
RES=$(ffmpeg -loglevel panic -nostats -f concat -safe 0 -i $FILESFILE -c copy $OUTFILENAME) | |
echo ".. done (exit code $?)" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment