LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Zenwalk (https://www.linuxquestions.org/questions/zenwalk-75/)
-   -   How to convert WAV or OGG files to MP3? (https://www.linuxquestions.org/questions/zenwalk-75/how-to-convert-wav-or-ogg-files-to-mp3-916283/)

Javelin Dan 11-29-2011 08:47 PM

How to convert WAV or OGG files to MP3?
 
I'm a newbie trying to figure out how to convert downloaded audio files to MP3. I looked in the Zenwalk Manual, and it mentioned the softwares "Assunder" and "Lame" - neither of which I can find in Netpkg. I basically just want to rip CD's, convert to MP3, and load them on a flashdrive so I can plug it into my car radio. Any help would be appreciated. Thanks!

aus9 11-29-2011 08:55 PM

easiest is to use ffmpeg

how shows here
http://www.mygnulinux.com/?p=56

but it has dependencies i don't use zenwalk but maybe this helps
http://packages.zenwalk.org/?p=ffmpe...rsion=snapshot

---------- Post added 30-11-11 at 10:55 ----------

easiest is to use ffmpeg

how shows here
http://www.mygnulinux.com/?p=56

but it has dependencies i don't use zenwalk but maybe this helps
http://packages.zenwalk.org/?p=ffmpe...rsion=snapshot

cascade9 11-30-2011 03:54 AM

FFmpeg might be easy to use, if you are the sort of person who likes using the command line, and can remember the commands.

IMO its easier to use a GUI CD ripper. Personally I prefer Rubyripper to the other linux CD rippers, but all should do a decent job for MP3s.

@ Javelin Dan- maybe it would help if you spelt the name right? Its 'asunder', not 'assunder'

http://littlesvr.ca/asunder/

jschiwal 11-30-2011 04:54 AM

The K3B CD burning program is another program that can rip CDs. I checked the zenwalk site, and it is listed.

Javelin Dan 11-30-2011 10:27 AM

Thanks to all who responded. Yeah, My spellin nevr was two gud. I'll try your suggestions and report back - may take a few days. Just to let you know, I'm not AT ALL comfortable with the command line - I'm OK with one or two simple commands, but get absolutely lost in long strings of code. So I'd like to do this as simply as possible; within a desktop environment if at all possible. Thanks again!

vharishankar 11-30-2011 10:30 AM

I've actually written a script to do this.

You need oggdec and lame to do this:
Code:

#!/usr/bin/env python

# Simple python script to convert all ogg files in a current directory to mp3 format

import os
import os.path
 
def get_files (extensions):
        files = os.listdir (os.getcwd())
        retfiles = []
        for file in files:
                for extension in extensions:
                        if (file.endswith (extension)):
                                retfiles.append (file)
       
        return retfiles
               
def convert_to_mp3 ():
        oggfiles = get_files ([ '.ogg', '.ogm'])
       
        for ogg in oggfiles:
                ret1 = os.spawnlp (os.P_WAIT, 'oggdec', 'oggdec', ogg)
                if (ret1 == 0):
                        rawfilename = os.path.splitext (ogg)
                        wavfilename = rawfilename[0] + '.wav'
                        mp3filename = rawfilename[0] + '.mp3'
                        ret2 = os.spawnlp (os.P_WAIT, 'lame', 'lame', wavfilename, mp3filename)
                        if (ret2 == 0):
                                os.spawnlp (os.P_WAIT, 'rm', 'rm', wavfilename)

convert_to_mp3 ()

Save as ogg2mp3.py and make it executable. You can run it to convert all OGG files to MP3. It works in python 2.x. Not sure if it's compatible with python 3 though.

Run it from the command line as
Code:

./ogg2mp3.py
and it will convert all your OGG files in the current directory to MP3.

To make it usable anywhere on your system, you need to put this script in a directory like /usr/bin/ or /usr/local/bin/

aus9 11-30-2011 05:59 PM

hi

my link shows you how to convert.

the command is (as a non-root user)

Code:

ffmpeg -i trackX.wav trackX.mp3
I did not suggest ripping software but you already mentioned asunder

Javelin Dan 12-06-2011 09:15 AM

Solved!
 
I just wanted to report back and chronicle my success for all the other raw newbies that follow in my footsteps. First, I want to thank everyone who responded. It was because of your response (plus some scrounging on the beginner’s forum) that I was able to figure this out. I know many of you monitor this forum regularly and try to help as many people as possible. Being a rank armature myself, most of the problems I had was simply in not knowing and having to figure out some basic stuff that most people would assume was common knowledge. Here’s what I did:

1). I went to the default repository and downloaded “Asunder”. My main problem here was lack of full knowledge of how to use the repository. I did not have a check mark next to “not installed” on the right side of the repository page. When I finally figured this out, it opened up a vast amount of available software that I didn’t previously know was there. Once revealed, I easily found “Asunder and downloaded it.

2.) I went to the first “restricted” repository and eventually found “Lame”. I say eventually because I first clicked on the restricted choice but saw the same repository I’d had before. I then remembered that whenever you change repositories, you have to click the “reload” button at the top right side of the page. Once done, all was well and I found “Lame”. Note: remember to re-select your default repository and reload the page before you leave!

3.) Using “Asunder” couldn’t be much easier, but a few footnotes are necessary for the beginner. Simply insert a CD of your choice, close out of “CD Player” that will automatically begin, select “Multimedia” from the applications menu, and click on “Asunder”. Note that the default format to save the ripped files is OOG. Simply go into the preferences tab and put a check next to Mp3. While there, de-select OGG or you will have files of both formats in your music folder – ask me how I know. Everything else is slick as snot! Click on “Rip” and find something to do for 5 or 10 minutes. When done, close out of “Asunder” and find your newly ripped files in your home folder, then drag-n-drop to your Music folder (or wherever you wish). Then, insert your flash drive, Mp3 player, etc, right click on your chosen music file, and click “send to” (select device). It’s really as simple as that! Last night I ripped about 7 Christmas CD’s and moved them to a flash drive that I plugged into the car radio so my wife can enjoy them while she drives without the hassle of shuffling multiple CD’s. If I can figure it out, anyone can! Enjoy your music!
:)

vharishankar 12-06-2011 09:45 AM

Glad to see you got a solution.

By the way, I always recommend lame for MP3 encoding. In the past I have had problems playing MP3s on hardware devices when the MP3s were generated from other programs like GStreamer or VLC (through some CD-ripping front-end programs). For some odd reason some of those MP3s show up as "unrecognized format" on some hardware media players. Probably has to do with variable bitrate MP3s or because some programs use the MP2 codec when MP3 is not available.

Javelin Dan 12-06-2011 10:34 AM

vharishankar -

Is this done automatically since I installed "Lame" or are there further steps I need to take that I don't know about? All the various CD's I ripped seem to play just fine so far...

vharishankar 12-06-2011 10:39 AM

Quote:

Originally Posted by Javelin Dan (Post 4543522)
vharishankar -

Is this done automatically since I installed "Lame" or are there further steps I need to take that I don't know about? All the various CD's I ripped seem to play just fine so far...

If it uses lame as the encoder it should be fine. Seeing its dependencies, I guess it uses lame so you should have no problem with the MP3s.

Note:
your test bed should be a hardware MP3 player if you use them. If it plays fine in your Linux system, that by itself is not a sign that the MP3 file would play fine in hardware player. However, if you aren't using any hardware MP3 players, you needn't worry.

Some of the cheaper type of hardware MP3 players also seem to have trouble with Variable Bitrate MP3s.

Javelin Dan 12-06-2011 11:25 AM

How do I check to make sure it is using "Lame" and how do I change it if not?

vharishankar 12-07-2011 06:53 AM

Quote:

Originally Posted by Javelin Dan (Post 4543574)
How do I check to make sure it is using "Lame" and how do I change it if not?

If it is listed as a dependency, I figure it must be using lame.

Also you can check if lame is running in the background during the encoding, by running top or checking System Activity (in KDE the key is Ctrl+Esc to bring up system tasks).

(Note: if a program uses libmp3lame directly, lame won't be running in the background)

Javelin Dan 12-07-2011 08:07 AM

Thank you - I truly appreciate your help!


All times are GMT -5. The time now is 08:57 PM.