LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-18-2005, 06:16 AM   #1
manicman
Member
 
Registered: Oct 2005
Location: England (Southampton)
Distribution: Ubuntu 6.06 , Gentoo
Posts: 62

Rep: Reputation: 15
format problem


OK so hears is the problem i have about 20 gigs of music all on m4a (itunes don't ask why) and i want to convert them all to mp3 now i have established that by using the following command

for i in *.m4a
do
base=`basename "$i" .m4a`
faad -o - "$i" | lame -h -b 192 - "$base.mp3"
done ; rm *m4a

that will convert every m4a in that directory to mp3 now is there a way to alter that command so that it will search through the directory's and the directory's within those directory's and convert all the tracks contained within them.
 
Old 11-18-2005, 07:16 AM   #2
Y0jiMb0
Member
 
Registered: Jul 2003
Location: Valencia (Spain)
Distribution: slackware 11, FEDORA CORE 4, RHEL3, Gentoo...
Posts: 361

Rep: Reputation: 30
Hi!
don't
Code:
for i in */*.m4a
and
Code:
for i in */*/*.m4a
work?

Regards
 
Old 11-18-2005, 09:20 AM   #3
manicman
Member
 
Registered: Oct 2005
Location: England (Southampton)
Distribution: Ubuntu 6.06 , Gentoo
Posts: 62

Original Poster
Rep: Reputation: 15
hi it almost works it finds and converts the files ok but it converts them all to the directory i issue the command from and not to the directorys they came from. thanks for your help have you got any other ideas ?
 
Old 11-18-2005, 12:42 PM   #4
Y0jiMb0
Member
 
Registered: Jul 2003
Location: Valencia (Spain)
Distribution: slackware 11, FEDORA CORE 4, RHEL3, Gentoo...
Posts: 361

Rep: Reputation: 30
Hi!
yes you're right.
Take a look at "basename --help". It looks like it removes any directory name.
I think you should make a list of directories, visit them one after the other and once there process the files inside.
This command should be helpful:
Code:
find -type d
typing just it shows you all the directories inside the PWD and down.
So this
Code:
for i in `find -type d`
do
cd $i
for j in *.m4a
do 
base=`basename "$j" .m4a`
faad -o - "$i" | lame -h -b 192 - "$base.mp3"
rm *.m4a
done
cd -
done
should work.

Regards
 
Old 11-19-2005, 01:38 PM   #5
manicman
Member
 
Registered: Oct 2005
Location: England (Southampton)
Distribution: Ubuntu 6.06 , Gentoo
Posts: 62

Original Poster
Rep: Reputation: 15
still not working ive tried playing with this a little bit but got no where. it does convert the files to some sort of mp3 but there not readable and there only a few KB's. for some reason it asks for permission to remove the orginal m4a's this time where as it didnt before hears the code

Code:
chris@home2-linux:~/Desktop$ for i in Alter_Bridge/One_Day_Remains/
> do
> cd $i
> for j in *.m4a
> do 
> base=`basename "$j" .m4a`
> faad -o - "$i" | lame -h -b 192 - "$base.mp3"
> rm *.m4a
> done
> cd -
> done
 *********** Ahead Software MPEG-4 AAC Decoder V2.0 ******************

 Build: Oct  9 2005
 Copyright 2002-2004: Ahead Software AG
 http://www.audiocoding.com
 Floating point version

 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License.

 **************************************************************************

Error opening file: Alter_Bridge/One_Day_Remains/
Assuming raw pcm input file
LAME version 3.96.1 (http://lame.sourceforge.net/)
CPU features: MMX (ASM used), 3DNow! (ASM used), SSE
Using polyphase lowpass filter, transition band: 19383 Hz - 19916 Hz
Encoding <stdin> to 01 Find The Real.mp3
Encoding as 44.1 kHz 192 kbps j-stereo MPEG-1 Layer III (7.3x) qval=2
rm: remove write-protected regular file `01 Find The Real.m4a'? y
rm: remove write-protected regular file `02 One Day Remains.m4a'? y
 *********** Ahead Software MPEG-4 AAC Decoder V2.0 ******************

 Build: Oct  9 2005
 Copyright 2002-2004: Ahead Software AG
 http://www.audiocoding.com
 Floating point version

 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License.

 **************************************************************************

Error opening file: Alter_Bridge/One_Day_Remains/
Assuming raw pcm input file
LAME version 3.96.1 (http://lame.sourceforge.net/)
CPU features: MMX (ASM used), 3DNow! (ASM used), SSE
Using polyphase lowpass filter, transition band: 19383 Hz - 19916 Hz
Encoding <stdin> to 02 One Day Remains.mp3
Encoding as 44.1 kHz 192 kbps j-stereo MPEG-1 Layer III (7.3x) qval=2
rm: cannot remove `*.m4a': No such file or directory
/home/chris/Desktop
chris@home2-linux:~/Desktop$
i may of done something stupid im quite new to linux thanks for your help so far

Last edited by manicman; 11-19-2005 at 02:00 PM.
 
  


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
format a hard drive (/dev/hda1) in Reiser fs format Linh Linux - General 7 06-17-2009 07:30 AM
SD Card format problem drj000 Linux - Hardware 0 03-21-2005 12:02 AM
HD won't format, RH9 Problem Ulaire Smiley Linux - Newbie 1 10-21-2003 02:05 AM
Format Problems Saving Star Office Docs in Word Format kkempter Linux - Software 4 08-27-2003 05:23 PM
format hdd problem jdhogg Linux - General 6 07-15-2003 08:55 AM


All times are GMT -5. The time now is 03:34 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration