Once I start this convertscript.sh
I want it to constantly check the files in the directory, if theres an .mkv
it will convert it which it does fine at the moment, but when there are no mkv
files left it seems to exit out the script, but I want it to loop and keep trying the script constantly.
Basically if a new file gets added say during the night because the script is looping constantly it picks it up, I don't want to run the convertscript.sh
again. I want to run convertscript.sh
once initially and then not touch it.
The script I've got so far is below:
shopt -s globstar
for f in **/*.mkv
do
ffmpeg -i "$f" -c:v libx264 -preset ultrafast -minrate 4.5M -maxrate 4.5M -bufsize 9M -c:a ac3 "${f%mkv}mp4";
[[ $? -eq 0 ]] && rm "$f";
done