How to decode MP3 in Android in the app?

I am currently working on an application that allows the user to select MP3 audio files. Then the file is processed by my application.

For this processing, the application will have to decode the audio files to get the original PCM output.

To decode MP3, I have two options:

  • Use the Android system to decode MP3 and receive PCM data.
  • Decode your own MP3s over the phone, paying for FREE MP3 royalties.

My question is: is it technically # 1 technically? And for No. 2, does the application apply to the MP3 license on the phone?

+7
source share
3 answers

As far as I know, Android support is not provided for decoding MP3 files.

I have used JLayer in the past and can recommend it for MP3 processing. Using NDK with the C ++ library may be faster, but if you want to keep Java, this is what I will use. This is even faster than in real time, about 30 seconds, for decoding all frames in an average bitrate of 3 minutes MP3. This is with the Galaxy S (1 GHz), so more and more new phones are faster.

As for licensing, I cannot help you. JLayer itself is LGPL, but the world of MP3 licensing is darker than the engine oil used. After several days of searching for a specific answer, I just gave up and did it. The world as a whole seems divided on who even owns the license in the first place.

+2
source

Option 1 is definitely not possible (unless you want to target ICS + devices and are ready to write your own C code to decode MP3 with OpenSL). The geobits recommendation for jLayer is a good one. For the most part, working with jLayer is a breeze. Here's a good blog post to help: http://mindtherobot.com/blog/624/android-audio-play-an-mp3-file-on-an-audiotrack/

0
source

Android system can now decode mp3 file, see here it describes the support of the media codec, container and network protocol provided by the Android platform.

MedieCodec is a very powerful medium for encoding and decoding a media file.

0
source

All Articles