How to decode MP3 in Android within app?

前端 未结 3 573
暗喜
暗喜 2020-12-18 01:04

I\'m currently working on an app that lets the user choose an MP3 audio file. The file is then processed by my app.

For this processing, the application would need t

相关标签:
3条回答
  • 2020-12-18 01:43

    Option 1 is definitely not possible (unless you want to target ICS+ devices and are willing to write native C code to decode MP3s with OpenSL). Geobits recommendation of jLayer is a good one. For the most part, dealing with jLayer is a breeze. Here's a good blog post that will help: http://mindtherobot.com/blog/624/android-audio-play-an-mp3-file-on-an-audiotrack/

    0 讨论(0)
  • 2020-12-18 01:46

    To my knowledge, there is no Android-provided way to decode MP3s.

    I've used JLayer in the past, and can recommend it for MP3 processing. Using the NDK with a c++ library might be faster, but if you're looking to keep it Java, that's what I'd use. It's still faster than real-time, roughly 30 seconds to decode all frames in an average bitrate 3 minute MP3. That's with an Galaxy S(1GHz), so any newer phones are faster.

    As far as licensing goes, I can't help you there. JLayer itself is LGPL, but the world of MP3 licensing is murkier than used motor oil. After a few days of searching for a concrete answer, I just gave up and did it. The world at large seems divided on who even holds the license in the first place.

    0 讨论(0)
  • 2020-12-18 01:58

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

    The MedieCodec is a very powful framework to encode and decode media file.

    0 讨论(0)
提交回复
热议问题