Java库从MP3文件中提取音频信息 [英] Java library for extracting audio information from MP3 files

查看:1063
本文介绍了Java库从MP3文件中提取音频信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有免费的图书馆(除Java媒体框架等),我可以用它来提取比特率(如128 kbps的,VBR),并从MP3文件中的音频质量(如为44.1KHz,立体声)<? / p>

我想,我可以纳入我的应用程序JAR,将老的Mac上也只具有Java 1.5的上市,我不能让他们升级或任何大的Java库添加到部署了一个独立的库。

只是为了澄清:我不会玩,跨code或做任何的排序与音频流本身,我感兴趣的只有元


解决方案

我承认我不知道很多关于MP3文件,但你可以从的格式规范的,需要的所有信息都在该文件的32位长的头。

您可以打开与MP3一个的FileInputStream ,看了前4个字节的文件,并使用一些简单的二元面具,获取你需要的信息。使用一个专门的图书馆恕我直言,是有点矫枉过正。

Is there any freely available library (other than java media framework) that I can use to extract the bit rate (eg. 128 kbps, VBR) and the audio quality (eg 44.1KHz, Stereo) from a MP3 file?

I would like a standalone library that I can incorporate into my application jar, to be deployed on older Macs too that have only Java 1.5 available and I can't get them upgraded or add any big Java library to.

Just to clarify: I will not play, transcode or do anything of the sort with the audio stream itself, I am interested in the metadata only.

解决方案

I confess I do not know much about MP3 files, but you can see from the format specification that all the informations needed are in the 32 bits long header of the file.

You could open the MP3 with a FileInputStream, read the first 4 bytes of the file and, using some simple binary masks, retrieve the informations you need. IMHO using a specialized library for that is a bit of an overkill.

这篇关于Java库从MP3文件中提取音频信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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