使用 Java 读取远程 MP3 文件的 ID3 标签 [英] Reading Remote MP3 File's ID3 Tags using Java
问题描述
我正在寻找一种无需实际下载文件即可从远程服务器上的 MP3 文件读取 ID3 标签的方法.我见过像 JAudioTagger 和 Entagged 这样的库,但两者似乎都需要文件对象而不是 URL 或 InputStream,我知道如何使用远程文件获取它们.有没有其他图书馆可以做到这一点?或者有没有办法让正确的对象使用 URL 与这些类进行交互?
I am looking for a way to read the ID3 tags from an MP3 file on a remote server without actually downloading the file. I have seen libraries like JAudioTagger and Entagged, but both seem to require a file object and not a URL or InputStream, which I know how to get with a remote file. Is there another library that can do this? Or is there a way to get the correct object to interact with these classes using a URL?
推荐答案
本页介绍了如何获取 ID3 V.1 MP3 文件的标签.http://willcode4beer.com/parsing.jsp?set=mp3ID3
This page describes how to get the ID3 V. 1 tags of an MP3 file. http://willcode4beer.com/parsing.jsp?set=mp3ID3
它提供了一个..
public Tag readTag(InputStream in, long start) throws ..
.. 远程 URL 所需的方法.基本思想是获取 URLConnection &查询 MP3 中数据的长度,然后从该数字中减去 128 &使用它作为开始参数(否则它会非常慢).
..method that is what you will want for a remote URL. The basic idea would be to get an URLConnection & query it for the length of the data in the MP3, then subtract 128 from that number & use that as the start argument (otherwise it will be very slow).
这篇关于使用 Java 读取远程 MP3 文件的 ID3 标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!