- Unnamed
- Saturday, March 29th, 2008 at 10:28:42am MDT
- #!/bin/bash
- # mp3tom4a.sh
- # bulk mp3 to m4a converter to generate bookmarkable aac files
- #requires mplayer, id3v2, aacplusenc and nokiatagger
- mp3files="*.mp3"
- wavend=wav
- aacend=m4a
- outdir=/media/Media/Music/M4A #change this
- for file in $mp3files
- do
- basenam=${file%.*3} # Get the first part of the filename, without the mp3 part
- mp3file=$file
- wavfile=${basenam}.$wavend
- aacfile=${basenam}.$aacend
- # Then run mplayer on the file, generating a wav file, using the mp3 file
- mplayer -vo null -vc null -ao pcm:fast:file="${wavfile}" "${mp3file}"
- id3v2 -C $file
- TITLE="`id3v2 -l $file | grep TIT2 | awk '{ORS=" "} {for (i = 4; i <= NF; i++) print $i}'`"
- ARTIST="`id3v2 -l $file | grep TPE1 | awk '{ORS=" "} {for (i = 4; i <= NF; i++) print $i}'`"
- ALBUM="`id3v2 -l $file | grep TALB | awk '{ORS=" "} {for (i = 4; i <= NF; i++) print $i}'`"
- TRACK="`id3v2 -l $file | grep TRCK | awk '{ORS=" "} {for (i = 6; i <= NF; i++) print $i}'`"
- YEAR="`id3v2 -l $file | grep TYER | awk '{ORS=" "} {for (i = 3; i <= NF; i++) print $i}'`"
- aacplusenc "${wavfile}" "${aacfile}" 64
- nokiatagger -t "$TITLE" -a "$ARTIST" -y "$YEAR" -A "$ALBUM" "${aacfile}"
- # faac -b 96 -c 44100 --title "$TITLE" --artist "$ARTIST" --year "$YEAR" --album "$ALBUM" --track "$TRACK" -w -o ${aacfile} ${wavfile}
- rm "${wavfile}"
- mv "${aacfile}" "$outdir"
advertising
Update the Post
Either update this post and resubmit it with changes, or make a new post.
You may also comment on this post.
Please note that information posted here will expire by default in one month. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.