Last active
November 13, 2019 21:57
-
-
Save hjue/0e3098712b8552a8d76223e883818392 to your computer and use it in GitHub Desktop.
convert m4a to mp3
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
author="" | |
title="" | |
album="" | |
output="mp3" | |
for i in `find . -maxdepth 1 -type d 2>/dev/null` | |
do | |
if [ "$i" = "." ]; then | |
continue | |
fi | |
album=${i/.\//} | |
echo $album | |
for filename in $album/*.m4a ; | |
do | |
# echo $filename | |
if [ -f "$filename" ] ; then | |
if [ ! -d "$output/$album" ] ; then | |
mkdir "$output/$album" | |
fi | |
basename=`basename "$filename"` | |
title=`echo ${basename%.*}` | |
file="${title}.mp3" | |
outputfile="$output/$album/$file" | |
# echo $outputfile | |
# echo $filename | |
ffmpeg -y -i "$filename" -metadata title="$title" -metadata artist="$author" -metadata album="$album" -codec:a libmp3lame -ab 64k "${outputfile// /_}"; | |
fi | |
done | |
done | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment