LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 03-19-2006, 07:27 PM   #1
corvax
LQ Newbie
 
Registered: Jan 2006
Posts: 13

Rep: Reputation: 0
Itunes and audio codecs


Hello Ive been dowloading songs from the itms using sharpmusique dvd jon was nice enought to put a debian package up on his site. It works excellent but it saves the files as .m4a. I found two scripts to convert m4a to mp3 ill post them both the first one ive been using it works great but doesnt save the tag info ie.. title artist year etc which i want. The second one does but it doesnt seem to work, bear in mind im using it as is so if you notice any errors in it let me know maybe im supposed to uncomment somthing or customize part of it but im not sure... so here they are

the fist one that works is m4a2mp3 here........

#!/bin/sh
#
# m4a to mp3

for i in *.m4a; do

faad "$i"
x=`echo "$i"|sed -e 's/.m4a/.wav/'`
y=`echo "$i"|sed -e 's/.m4a/.mp3/'`
lame -h -b 192 "$x" "$y"
rm "$x"

done


The second one i cant get working is m4a2mp3 -- For preserving the music info (tags) here......................

#!/bin/sh
#
# m4a to mp3

trap 'rm -f "$info" "$opts" "$wav" "$mp3"; exit 10' 1 2 3 15

for m4a in "$@"; do

opts=` echo "$m4a"|sed -n 's/\.m4a$/.opts/p'`
wav=` echo "$m4a"|sed -n 's/\.m4a$/.wav/p'`
mp3=` echo "$m4a"|sed -n 's/\.m4a$/.mp3/p'`
[ -z "$mp3" ] && continue

# study it
faad -i "$m4a" | sed -n '
s/["`$]/\\\&/g # handle any escapes in titles
s/^title: \(.*\)$/--tt "\1"/p
s/^artist: \(.*\)$/--ta "\1"/p
s/^album: \(.*\)$/--tl "\1"/p
s/^track: \(.*\)$/--tn "\1"/p
s/^date: \([12][0-9][0-9][0-9]\)$/--ty "\1"/p # year?
#s/^genre: \(.*\)$/--tg "\1"/p # m4a genres dont match those of mp3
' - > "$opts"

# convert it
faad "$m4a"
#cat "$opts" # debugging
# Other option for lame -b 192
eval "lame -h "`cat "$opts"`" \"$wav\" \"$mp3\""

# cleanup
rm -f "$opts" "$wav"

done
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Newbie needs help installing audio codecs through proxy NeoLives Ubuntu 1 12-03-2005 04:00 PM
Audio player like iTunes TomalakBORG Linux - Software 4 04-01-2005 01:42 PM
video and audio codecs salahuddin_66 Linux - General 0 08-13-2004 01:37 AM
.MOV audio codecs?!? Vid Linux - Software 3 02-11-2004 11:36 PM
mplayer audio codecs bitterjack Red Hat 2 09-15-2003 02:57 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 03:04 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration