Created
February 9, 2017 20:07
-
-
Save doxt3r/2e3ff2b5e7daee1c61add30f897a439a to your computer and use it in GitHub Desktop.
This file contains 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 | |
# | |
# m4a to ogg | |
# faad tool needs to be installed in your machine inorder to retrive metadata infos. | |
for i in *.m4a; do | |
tmp=$(mktemp) | |
y=`echo "$i"|sed -e 's/.m4a/.ogg/'` | |
faad -i "$i" 1>/dev/null 2>"$tmp" | |
if [ $? -ne 0 ] ; then | |
rm "$tmp" | |
echo "failed to get information from $i" | |
continue | |
fi | |
title=`grep 'title: ' "$tmp"|sed -e 's/title: //'` | |
artist=`grep 'artist: ' "$tmp"|sed -e 's/artist: //'` | |
album=`grep 'album: ' "$tmp"|sed -e 's/album: //'` | |
genre=`grep 'genre: ' "$tmp"|sed -e 's/genre: //'` | |
track=`grep 'track: ' "$tmp"|sed -e 's/track: //'` | |
year=`grep 'year: ' "$tmp"|sed -e 's/date: //'` | |
faad "$i" -o - | oggenc -q 4 -t "$title" -a "$artist" -l "$album" -G "$genre" -N "$track" -d "$year" -o "$y" - | |
if [ $? -ne 0 ] ; then | |
echo "failed to encode $i" | |
fi | |
rm "$tmp" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment