Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

c++ mp3 library [closed]

Tags:

c++

ffmpeg

mp3

I am exhausted searching for a c++ mp3 decoding library, preferably free (like lgpl) and cross-platform or for windows and mac. Can anyone suggest such library and post some tutorial for using it? ffmpeg and sdl (sdl_sound, sdl_mixer) aren't compiling. I am unable to get mpg123 working - is it for linux world only or what? Is there some tutorial on using mpg123 on windows? mpg123 is unable to find some symbols that is I am not putting some dll's at right path - but which?

Overall, I want be able to read and write all major audio file formats on windows and mac - starting with windows.

like image 361
user1288043 Avatar asked Mar 23 '12 10:03

user1288043


1 Answers

There are a couple of options:

  • GStreamer:

GStreamer is a cross-platform library for constructing graphs of media-handling components. The applications it supports range from simple Ogg/Vorbis playback, audio/video streaming to complex audio (mixing) and video (non-linear editing) processing.

This page has some very interesting info on GStreamer and the MP3 format, it's a must-read if you decide to go with GStreamer:

The MP3 audio format is a pain. It is patent-encumbered, making it hard for Linux distributors to package (or Linux users to use) legally in various parts of the world. It doesn't even sound all that good, compared to some of the alternatives. Yet MP3 is hard to avoid;

Besides that, Gstreamer ofers a command-line interface through gst-launch which is very useful to test the pipeline you are assembling in your program before you start to write code the actual code:

gst-launch filesrc location=/path/to/audiofile ! decodebin ! oss4sink

And if you need to build GStreamer on Windows, check this tutorial for Visual Studio.

  • PortAudio:

PortAudio is a free, cross-platform, open-source, audio I/O library. It lets you write simple audio programs in 'C' or C++ that will compile and run on many platforms including Windows, Macintosh OS X, and Unix (OSS/ALSA).

The MP3 support comes through libmad. There are tutorials that help building and using the library.

like image 188
karlphillip Avatar answered Oct 12 '22 22:10

karlphillip