Part of Slepp's ProjectsPastebinTURLImagebinFilebin
Feedback -- English French German Japanese
Create Upload Newest Tools Donate
Sign In | Create Account

Unnamed
Saturday, March 29th, 2008 at 10:28:42am MDT 

  1. #!/bin/bash
  2.  # mp3tom4a.sh
  3.  # bulk mp3 to m4a converter to generate bookmarkable aac files
  4.  #requires mplayer, id3v2, aacplusenc and nokiatagger
  5.  
  6.  mp3files="*.mp3"
  7.  wavend=wav
  8.  aacend=m4a
  9.  outdir=/media/Media/Music/M4A #change this
  10.  
  11.  for file in $mp3files
  12.  do
  13.  
  14.  basenam=${file%.*3} # Get the first part of the filename, without the mp3 part
  15.  mp3file=$file
  16.  wavfile=${basenam}.$wavend
  17.  aacfile=${basenam}.$aacend
  18.  
  19.  # Then run mplayer on the file, generating a wav file, using the mp3 file
  20.  mplayer -vo null -vc null -ao pcm:fast:file="${wavfile}" "${mp3file}"
  21.  
  22.  id3v2 -C $file
  23.  
  24.  TITLE="`id3v2 -l $file | grep TIT2 | awk '{ORS=" "} {for (i = 4; i <= NF; i++) print $i}'`"
  25.  ARTIST="`id3v2 -l $file | grep TPE1 | awk '{ORS=" "} {for (i = 4; i <= NF; i++) print $i}'`"
  26.  ALBUM="`id3v2 -l $file | grep TALB | awk '{ORS=" "} {for (i = 4; i <= NF; i++) print $i}'`"
  27.  TRACK="`id3v2 -l $file | grep TRCK | awk '{ORS=" "} {for (i = 6; i <= NF; i++) print $i}'`"
  28.  YEAR="`id3v2 -l $file | grep TYER | awk '{ORS=" "} {for (i = 3; i <= NF; i++) print $i}'`"
  29.  
  30.  aacplusenc "${wavfile}" "${aacfile}" 64
  31.  nokiatagger -t "$TITLE" -a "$ARTIST" -y "$YEAR" -A "$ALBUM" "${aacfile}"
  32.  # faac -b 96 -c 44100 --title "$TITLE" --artist "$ARTIST" --year "$YEAR" --album "$ALBUM" --track "$TRACK" -w -o ${aacfile} ${wavfile}
  33.  
  34.  rm "${wavfile}"
  35.  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.

update paste below
details of the post (optional)

Note: Only the paste content is required, though the following information can be useful to others.

Save name / title?

(space separated, optional)



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.

worth-right