html5音频。如何获得比特率 [英] html5 audio. How to get bitrate
问题描述
我正在为Google Chrome编写扩展程序。我有一种情况:我有一个mp3文件的链接,我可以播放它。我可以提取它的持续时间。
但我怎么能计算比特率?是否有可能通过一些属性?或通过一些使用文件大小的计算?如果第二个 - 如何获取文件大小?
谢谢。
更新:
执行HEAD请求并从内容长度标题。因为你知道持续时间,所以你可以计算比特率。
研究:
p>在这里,我想分享一些我的研究成果。您可能已经知道这一点 - 根据 MP3格式规范。但我相信你宁愿不读档案,自己处理所有这些!希望你可以找到工具或API来提供帮助。考虑到这一点...
-
我环顾公众网络API,将提取MP3的信息,但没有找到如果你能找到一个 ExifTool ,你可以从Chrome访问,它有一个API来计算比特率。
有一个Javascript库称为 SoundManager ,看起来很有希望,但它不能准确计算比特率。 -
我看了 Web Audio API ,但没有看到特别提及读取MP3文件,因此无法提取比特率。
I looked around for public web APIs that will extract info for MP3's but didn't find anything that jumped out at me.
If you can find a version of ExifTool that you can access from Chrome, it has an API to calculate bitrate.
There is a Javascript library called SoundManager that looked promising, but it does not accurately calculate bitrate.
I looked at the Web Audio API but did not see any mention of reading MP3 files in particular, and therefore no way to extract bitrate.
I'm writing an extension for google chrome. And I have a situation: I've got a link for mp3 file, and I could play it. I could extract duration of it..
But how could I calculate bitrate? Is it possible through some properties? Or through some calculations using file size? If second - how to get filesize?
Thanks.
Update:
Do a HEAD request and get the filesize from the Content-Length header. Since you know the duration, you can then calculate the bitrate.
Research:
Here I want to share some of my research.
You probably already know this -- the bitrate is stored inside according to the MP3 format specification. But I'm sure you would rather not read the file and deal with all that yourself! Hopefully you can find tools or API's to help. With that in mind...
这篇关于html5音频。如何获得比特率的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!