This commit is contained in:
2020-11-28 16:48:13 -05:00
2 changed files with 17 additions and 0 deletions

2
README.md Normal file
View File

@@ -0,0 +1,2 @@
# Ray's Useful Scripts
A collection of scripts that have helped me at home and in the office.

View File

@@ -94,8 +94,23 @@ else
error_exit "$LINENO: Not a valid source" 1>&2 error_exit "$LINENO: Not a valid source" 1>&2
fi fi
<<<<<<< HEAD
echo "File(s) encoded successfully!" echo "File(s) encoded successfully!"
exit 0 exit 0
=======
# Encode each file in the directory with different CRF setting based on resolution
for FILE in "$DIRECTORY"/*.*; do
RES=$(ffprobe -v error -select_streams v:0 -show_entries stream=width -of default=noprint_wrappers=1:nokey=1 "$FILE")
FILENAME=$(basename "$FILE")
if [[ $RES -gt 1920 ]]; then
ffmpeg -i "$FILE" -c:v libx264 -preset slow -tune film -crf "$QUALITY_4K" -c:a copy "$DIRECTORY"/output/"$FILENAME"
elif [[ $RES -le 1920 ]]; then
ffmpeg -i "$FILE" -c:v libx264 -preset slow -tune film -crf "$QUALITY_HD" -c:a copy "$DIRECTORY"/output/"$FILENAME"
else
echo "$FILENAME is not a valid filetype"
fi
done
>>>>>>> main