a pastebin project

Unnamed

  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

Create a Paste

Please enter your new post below (or upload a file instead):





Please note that information posted here will not expire by default. If you 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.

worth-right
fantasy-obligation