dotfiles/home/default/scripts/convert-to-audio

33 lines
592 B
Plaintext
Raw Normal View History

2023-10-16 09:24:46 -04:00
#!/usr/bin/env sh
# rename .MKV -> .MKV
count=`ls -1 *.JPG 2>/dev/null | wc -l`
if [ $count != 0 ]; then
rename MKV mkv *.MKV
fi
# convert to opus
count=`ls -1 *.mkv 2>/dev/null | wc -l`
if [ $count != 0 ]; then
for i in *.mkv; do
ffmpeg -i "$i" "${i%.mkv}.opus";
rm "$i";
done
fi
# rename .WEBM -> .webm
count=`ls -1 *.WEBM 2>/dev/null | wc -l`
if [ $count != 0 ]; then
rename WEBM webm *.WEBM
fi
# convert to opus
count=`ls -1 *.webm 2>/dev/null | wc -l`
if [ $count != 0 ]; then
for i in *.webm; do
ffmpeg -i "$i" "${i%.webm}.opus";
rm "$i";
done
fi