Created
February 22, 2018 21:11
-
-
Save conrad784/2787eb128a36ec4401b3a551c42891ae to your computer and use it in GitHub Desktop.
convert mkv movie files to h264 compressed versions in 720p
This file contains hidden or 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 | |
STOREDIR="smaller/" | |
OUTPUTFORMAT=".mkv" | |
SEARCHPATH="*" | |
mkdir -p ${STOREDIR} | |
if [ -z "$1" ] | |
then | |
echo "No arguments given" | |
else | |
args="$1" | |
if [ $args == "-r" ]; then | |
SEARCHPATH="*/*" | |
fi | |
fi | |
shopt -s nullglob | |
for i in $SEARCHPATH.mkv; | |
do name=`echo $i | cut -d'/' -f1 | rev | cut -d'.' -f2- | rev`; | |
echo $name; | |
FD="${STOREDIR}${name}${OUTPUTFORMAT}" | |
replace_with="720p" | |
FD="${FD/1080p/$replace_with}" | |
#echo $FD; | |
if [ ! -f "${FD}" ]; | |
then ffmpeg -i "$i" -c:v h264 -map 0 -c:a libmp3lame -b:a 192k -s hd720 "${FD}"; | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment