-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathffmp4.sh
More file actions
28 lines (22 loc) · 759 Bytes
/
ffmp4.sh
File metadata and controls
28 lines (22 loc) · 759 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# Variable expansion to make subfolder name same as parent
subfolder="${PWD##*/}"
if [ ! -d "$subfolder" ]; then
mkdir "$subfolder"
fi
# Derived from
# https://unix.stackexchange.com/questions/9496/looping-through-files-with-spaces-in-the-names
find . -type f \( -name "*.mp4" -or -name "*.avi" \) -exec bash -c '
for file in "$0"; do
basename="${file##*/}"
basename="${basename%.*}.mp3"
ffmpeg -i "$file" -q:a 3 -c:a libmp3lame "$1/$basename"
done
' {} "$subfolder" \;
printf "\n\n----- Done converting audio -----\n\n"
# Copy cover images
for c in cover*.{jpg,png}; do
cp "$c" "$subfolder/"
printf "$c copied successfully...\n"
done
mv "$subfolder" "/m/audio_immersion/$subfolder"
printf "Done moving files. Go check on your stuff!\n\n"