LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices


Reply
  Search this Thread
Old 05-14-2009, 01:37 PM   #1
j1alu
Member
 
Registered: Apr 2009
Distribution: debian gnu/linux
Posts: 798

Rep: Reputation: Disabled
decoding mp3 from cli


i gotta few mp3-files i`d like to burn to cd.
how would i decode them to wav from the commandline.
i tried with mpg321: mpg321 --wav *.mp3
but that didn`t work.
thanks
 
Old 05-14-2009, 02:43 PM   #2
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Debian + kde 4 / 5
Posts: 6,837

Rep: Reputation: 1986Reputation: 1986Reputation: 1986Reputation: 1986Reputation: 1986Reputation: 1986Reputation: 1986Reputation: 1986Reputation: 1986Reputation: 1986Reputation: 1986
You need to look more closely at the documentation. The command format is "mpg321 --wav outputfile.wav inputfile.mp3"

So if you want to convert multiple files in a single directory at once, you need to run it in a loop.

Code:
for FILE in *.mp3; do mpg321 --wav "${FILE%.mp3}.wav" "$FILE" ; done
This should take each file and convert them, keeping the same filename, but changing the ending to .wav.


On another note though, what program do you plan to use to burn the files to disk? Some of them, like k3b, can handle mp3 as an input file, and will automatically convert them for you before burning.

Last edited by David the H.; 05-14-2009 at 02:46 PM. Reason: fixed typo
 
Old 05-14-2009, 03:08 PM   #3
j1alu
Member
 
Registered: Apr 2009
Distribution: debian gnu/linux
Posts: 798

Original Poster
Rep: Reputation: Disabled
Quote:
You need to look more closely at the documentation.
Quote:
-w N, --wav N
Write to wav file N instead of using the audio device. This
option will be preferred if --cdr or --au are specified too.
Specifying ’-’ for N will cause the file to be written to
standard output.
that was the part i didn`t understand though i did read it quite often. "mpg321 --wav output.file input.file" would have been more easy for me. Anyway its much more comfortable with the loop you gave and that was what i wanted to be able to do. thanks
greetings

Last edited by j1alu; 05-14-2009 at 03:11 PM.
 
Old 05-17-2009, 01:42 PM   #4
j1alu
Member
 
Registered: Apr 2009
Distribution: debian gnu/linux
Posts: 798

Original Poster
Rep: Reputation: Disabled
Quote:
fubar$ pwd
/home/jalu/Music/music/jazz/The Complete Bitches Brew Sessions (Disc 1)

fubar$ ls
1-01 Pharaoh's Dance.mp3 1-03 Spanish Key.mp3
1-02 Bitches Brew.mp3 1-04 John McLaughlin.mp3

fubar$ for FILE in *.mp3; do mpg321 --wav "${FILE%.mp3}.wav" "$FILE" ; done
i get the four wav files, but they only produce noice.
what am i doing wrong? decoding one by one does work.
thanks

post-edit:
the problem was that there has been empty spaces in the file-names. it works fine now. thanks again.

Last edited by j1alu; 05-22-2009 at 01:07 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
CLI mp3 players reverse Linux - Software 4 11-10-2007 01:07 AM
Saving CLI data in the CLI Tons of Fun Linux - General 4 04-03-2007 05:42 AM
cli mp3 converter? wgato Linux - Software 3 09-09-2006 08:55 AM
decoding TazLinux Linux - General 4 11-29-2003 11:47 AM
decoding mp3 to pcm format !! Morpheus Programming 1 01-18-2003 08:28 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian

All times are GMT -5. The time now is 04:25 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