Created
April 1, 2018 08:02
-
-
Save vdugnist/c4af395ea9ff1cf85495202e4bdadbc6 to your computer and use it in GitHub Desktop.
Compress video folder
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 | |
if [[ ! $1 ]]; then | |
echo "directory path is required" | |
exit 1 | |
fi | |
dir_path=$1 | |
# remove last '/' if needed | |
if [ "${$dir_path: -1}" == "/" ]; then | |
dir_path=${dir_path%?} | |
fi | |
mkdir $dir_path-compressed | |
for filename in $(ls $dir_path); do | |
original_file_path=$dir_path/$filename | |
result_file_path=$dir_path-compressed/$filename | |
if [ ! -e $result_file_path ]; then | |
ffmpeg -i $original_file_path $result_file_path | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment