如何在应用内的Android中解码MP3? [英] How to decode MP3 in Android within app?

查看:124
本文介绍了如何在应用内的Android中解码MP3?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在开发一个允许用户选择MP3音频文件的应用程序.该文件然后由我的应用处理.

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

对于此处理,应用程序需要解码音频文件以获得原始PCM输出.

For this processing, the application would need to decode audio files to get the raw PCM output.

要解码MP3,我有两个选择:

To decode MP3, I have two options:

  1. 使用Android系统解码MP3并获取PCM数据.
  2. 自己在电话上解码MP3,无需支付MP3许可费.

我的问题是,从技术上讲第一名是否可行?对于#2,手机上的MP3许可证是否也涵盖一个应用程序?

My question is whether #1 is technically possible? And for #2, whether the MP3 license on the phone covers an app as well?

推荐答案

据我所知,没有Android提供的方法来解码MP3.

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

我过去曾经使用过 JLayer ,可以推荐它用于MP3处理.将NDK与c ++库一起使用可能会更快,但是如果您希望将其保留为Java,那就是我要使用的.它仍比实时速度快,大约需要30秒才能以平均比特率3分钟的MP3解码所有帧.这与Galaxy S(1GHz)配合使用,因此任何较新的手机都更快.

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.

就许可而言,我无法为您提供帮助. JLayer本身就是LGPL,但MP3许可的世界比二手机油更加模糊.在寻找了具体答案几天后,我只是放弃并做到了.整个世界似乎在谁首先拥有许可证上存在分歧.

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.

这篇关于如何在应用内的Android中解码MP3?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆