使用 html 5 最大程度地减少流音频中的延迟
我正在尝试在网页上收听延迟小于 3 秒的实时音频流。到目前为止,使用冰和水生成了 ogg vorbis 流。 Icecast,我无法让延迟低于 7 秒。到目前为止我使用过的所有播放器(Firefox、Opera、Safari 中的 html5 音频标签;以及 VLC)似乎都会引入类似的延迟。目前还不清楚ices/icecast 与客户端播放器相比引入了多少延迟。我已经调整了ices和icecast设置,但没有效果。
有没有人在类似的ices/icecast 设置中实现了比这更好的延迟?我不希望 ogg vorbis 解码器(无论是浏览器中的 html 5、VLC 或其他)将音频流延迟几秒钟。我错了吗?我找不到任何有关控制缓冲区大小或浏览器中解码的信息。
使用不同的架构(html 5、firefox、提供 wav 格式音频的 WSGI 服务器),我能够实现大约 1-2 秒的延迟。默认情况下,firefox 会延迟 5 秒以上开始播放 wav 文件,但我可以通过提前设置 audio.currentTime 来提前播放,并且只能向后播放 1-2 秒(有点脆弱)。然而,我更喜欢使用 Icecast,而流媒体 wav 显然无法扩展。
预先感谢您的任何想法。
I'm trying to listen to a live audio stream on a webpage with a latency of less than 3 seconds. So far with ogg vorbis streams generated using ices & icecast, I've been unable to get latencies less than 7 seconds. All players I've used so far (html5 audio tag in Firefox, Opera, Safari; VLC as well) seem to introduce similar delays. It's unclear at this point how much latency is introduced in ices/icecast vs. the client-side player. I've tweaked ices and icecast settings, to no avail.
Has anyone achieved better latencies than this in a similar ices/icecast setup? I wouldn't expect an ogg vorbis decoder (be it html 5 in a browser, VLC, or whatever) to delay an audio stream for multiple seconds. Am I incorrect? I can't find any info on controlling buffer sizes or the decoding in browsers.
With a different architecture (html 5, firefox, WSGI server serving wav format audio), I was able to achieve latencies around 1-2 seconds. By default, the firefox began playing the wav file 5+ seconds behind, but I could advance playback by setting audio.currentTime ahead, and only be 1-2 seconds back (somewhat fragile). However, I'd much prefer to use icecast, and streaming wavs obviously doesn't scale.
Thanks in advance for any ideas.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Icecast 和Shoutcast 服务器本身有内部缓冲区。我知道可以配置shoutcast(查看文档中的高级指令)。
The Icecast and Shoutcast servers themselves have internal buffers. I know the shoutcast one can be configured (look in the advanced directives in the docs).
有一些关于 Ogg / Vorbis 相关延迟的存档讨论线程:
答案似乎是你必须调整Ogg容器格式,然后Vorbis的剩余延迟不应该太高。
然而,我也经常读到新的 Opus 编解码器 更适合低延迟/延迟。请参阅此处或此处。
There are some archived discussions threads about Ogg / Vorbis related delay:
The answer seems to be that you have to tweek the Ogg container format, and then the remaining delay of Vorbis should not be too high.
However, I also often read that the new Opus codec is better suited for low delay/latency. See e.g. here or here.