[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Convert mp3 enbulk



On Mon, Feb 20, 2012 at 11:50:30AM -0700, Bob Proulx wrote:
> Curt wrote:
> > Bob Proulx wrote:
> > >> I'm lazy so I'd use the command line.
> > > I have the opposite problem.  Everything I have is in ogg format.  But
> > > sometimes I want to play on a device that doesn't understand ogg and
> > > can only play mp3 format.  I simply convert the file to .wav format
> > > and then encode it again to mp3.  You could do something similar.
> >
> > That's seems silly.  Why convert it to wav first?  Why not convert
> > directly to mp3:
> >  ffmpeg -i example.ogg to example.mp3
> > or whatever the command would be.
> 
> In my case I needed to produce mp3 files and mp3 encoders are of
> course patented and so not available in every tool and not available
> in the free ffmpeg.  Since wav files are lossless they are the desired
> middle layer.  If you are dealing with an audio collection then the
> size of the intermediate wav file isn't going to be a limiter.  The
> cpu encoding will be the limiter.  So for me going ogg to wav and then
> wav to mp3 was just perfect and impossible to do with ffmpeg.
> 
If you instead use flac as an intermediate step, you may be able to
preserve the meta tags.  Going to wav, you will almost certainly lose
them.

> Plus because ffmpeg is not the best tool for the wav to ogg task.  It
> is great for producing wav files but not as good as oggenc for vorbis
> encoding.
> 
>   $ ls -log 01_-_An_Awful_Lot_Of_Running.mp3
>   -rw-r--r-- 1 5.9M 2012-02-20 11:03 01_-_An_Awful_Lot_Of_Running.mp3
> 
>   $ ffmpeg -i 01_-_An_Awful_Lot_Of_Running.mp3 01_-_An_Awful_Lot_Of_Running.ogg
> 
>   $ ls -log 01_-_An_Awful_Lot_Of_Running.ogg
>   -rw-rw-r-- 1  27M 2012-02-20 11:06 01_-_An_Awful_Lot_Of_Running.ogg
> 
>   $ ffmpeg -i 01_-_An_Awful_Lot_Of_Running.mp3 01_-_An_Awful_Lot_Of_Running.wav
>   $ oggenc 01_-_An_Awful_Lot_Of_Running.wav
>   $ ls -log 01_-_An_Awful_Lot_Of_Running.ogg
>   -rw-rw-r-- 1 3.3M 2012-02-20 11:04 01_-_An_Awful_Lot_Of_Running.ogg
> 
> Look at the sizes of the files.  This is because ffmpeg is producing
> flac not vorbis encoding.  Remember that ogg is a container format not
> an encoding format.  In that case you might as well simply keep the
> wav files.  But of course we compress as a compromise in order to save
> disk space.  A *lot* of disk space.
> 
> There is almost certainly an option to ffmpeg to encode with vorbis
> encoding.  There is an option for everything.  And it is changing.
> Between Lenny and Squeeze and Wheezy it is evolving.  I know that by
> the time I read through all of the documentation to figure it out that
> I would already have had the job done using oggenc.  (This is
> someone's chance to jump in and tell us the optimal set of options to
> ffmpeg to produce an ogg vorbis file.  I know I would note the options
> down for future reference.)  But using oggenc is simple, immediately
> obvious, and does a good job of it.
> 
It would have to be one of these (but I haven't tested it)

ffmpeg -i somesong.mp3 -acodec vorbis somesong.ogg
or
ffmpeg -i somesong.mp3 -acodec libvorbis somesong.ogg

> Remember that the Unix philosophy is all about modularity.  Write
> small dedicated tools and join them together to produce a greater
> whole.  I would like to simply pipe from simple program to simple
> program and let a multi-core cpu run the processes in parallel.  Tools
> that try to do everything in one program with ten thousand options
> violate that philosophy and are harder to use and harder to expand
> upon.
> 
> > Anyway, it's double lossy whatever you do, and maybe even worse if you
> > go the roundabout wav route (though I don't really know, but you can't
> > fool mother nature).
> 
> Decoding and encoding again will obviously introduce artifacts.  Just
> like the laws of thermodynamics say you can't win, you can't get
> ahead, you will always lose.  But if you only have one thing and you
> want to get to another thing then you are going to transcode because
> that is what you have and there is no other way.  And if you are an
> average individual with average ears and an average set of headphones
> listening in an average environment it is unlikely that you will be
> able to tell the difference.  It won't be of the highest audio quality
> but neither will it be of the lowest.  And if your purpose is to
> listen while say biking out in the wind then you are most definitely
> not going to be able to tell the difference.
> 
I decided a few years ago that I'd use flac for my entire music
collection, and if needed, convert to another format for reasons of
portability, etc.  This way I only get one lossy transcode.

> > Or maybe my understanding is shaky you'll illuminate me.
> 
> Bob



Reply to: