如何从URL获取MP3的长度? [英] How do I get the length of an MP3 from its URL?

查看:131
本文介绍了如何从URL获取MP3的长度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我知道MP3文件的URL,最简单/最快的方法是获取其长度,比特率,大小等?

If I know the URL of an MP3 file, what is the easiest/fastest way to get its length, bitrate, size, etc?

如何仅下载MP3的ID3标签部分以获取这些详细信息?

How can I download just the ID3 tag part of the MP3 to get these details?

推荐答案

您将需要查看mp3文件中的ID3标签.

You will need to look at the ID3 tags in the mp3 file.

除非您在其他地方跟踪想要的元数据.

Unless you keep track of the metadata you want somewhere else.

要明确获取文件的Track长度,您需要确定ID3元数据标签,尤其是该标签的"TRCK"框架.

To specifically get the Track length of the file you will need to look into the ID3 metadata tag for sure, specifically the 'TRCK' frame of the tag.

要仅下载ID3标签部分,必须首先下载文件的ID3标头部分.

To only download the ID3 Tag part, you must first download the ID3 header part of the file.

网站包含有关ID3标签格式的非常具体的信息.您将需要查看ID3标签的版本号,然后基于该版本号查找有关ID3标签的持续时间的信息.然后,您必须下载WHOLE标记,因为框架的顺序不是特定的.

This website contains very specific information about the ID3 Tag format. You will need to look at the version number of the ID3 Tag and then, based on that, you will need to find the information regarding how long the ID3 Tag is. Then, you must download the WHOLE tag because the frames are not in any specific order.

然后,您应该可以使用第三方库来找到TRCK帧及其数据.

Then you should be able to use a third party library to find the TRCK frame and its data.

这篇关于如何从URL获取MP3的长度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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