Icecast 元数据提取在输出音频数据中产生伪影

发布于 2024-09-18 06:44:39 字数 1001 浏览 3 评论 0原文

我正在尝试(在 NodeJS 中):

  1. 连接到 Icecast 互联网音频流。例如: http://icecast3.977music.com/comedy
  2. 解析响应标头并提取 icy-metaint 值。
  3. 将原始音频数据写入文件,同时从音频流中提取元数据字节,以便:
    • 在元数据到达时拦截并解析元数据。
    • 不在输出文件中包含元数据字节,这样就不会因注入元数据而出现音频失真。

按照 SmackFu 的 “非官方”Shoutcast 元数据协议页面,我已经能够到目前为止:

https://gist.github.com/e7474421dcb25e011620

基本上,我能够在预期时提取元数据(要点中包含的流转储的最开始只有 1 个元数据事件)。那部分似乎工作得很好。

问题在于,输出 MP3 文件在整个文件中具有明显的音频伪影,大概是在元数据字节到达时。但是,我肯定会提取这些元数据字节并且不将它们包含在输出文件中,所以这是奇怪的部分。

上面链接中的协议文档没有说需要对输出文件执行任何其他操作,但显然我仍然做错了一些事情。有谁知道还需要对音频流做什么?提前致谢!

I am attempting to (in NodeJS):

  1. Connect to an Icecast internet audio stream. Ex: http://icecast3.977music.com/comedy
  2. Parse the response headers and extract the icy-metaint value.
  3. Write out the raw audio data to a file, while extracting the metadata bytes from the audio stream in order to:
    • Intercept and parse the metadata when it arrives.
    • Not include the metadata bytes in the output file, so that there are no audio artifacts because of the injected metadata.

Following the "unofficial" Shoutcast Metadata Protocol page from SmackFu, I have been able to get this far:

https://gist.github.com/e7474421dcb25e011620

Basically, I am able to extract the metadata when it is expected (there's only 1 metadata event at the very beginning of the stream dump included in the gist). That part seems to work fine.

The problem is that the output MP3 file has noticeable audio artifacts throughout the file, presumably when the metadata bytes is arriving. However, I am definitely extracting those metadata bytes and NOT including them in the output file, so that's the weird part.

The protocol document in the link above doesn't say anything else needs to be done to the output file, but obviously I'm still doing something wrong. Does anybody know what else needs to be done to the audio stream? Thanks in advance!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

若水微香 2024-09-25 06:44:45

我能够在 Node.js IRC 频道上解决这个问题。我在输出的音频字节数中出现“off by 1”错误,因此导致音频文件无效。

OP 中发布的要点已得到更正,现在可以正常工作。

这个小练习的延续是被打包到 Node.JS 模块中,以从 SHOUTcast/Icecast 流中读取音频和元数据。如果您感兴趣,请查看node-radio-stream

I was able to sort this out on the Node.js IRC channel. I had an "off by 1" error in the amount of audio bytes being output, so and resulted in an invalid audio file.

The gist posted in the OP has been corrected and now WORKS PROPERLY.

A continuation of this little exercise is being packaged into a Node.JS module to read audio and metadata from a SHOUTcast/Icecast stream. Check out node-radio-stream if you're interested.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文