rafael2k / darkice

DarkIce is a live audio streamer. It records audio from an audio interface (e.g. sound card), encodes it and sends it to a streaming server. This is the official development repository of Darkice.

Home Page:http://www.darkice.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Silence in stream causes latency (that grows over time), how can I correct it?

bnelson333 opened this issue · comments

Wondering if anybody can help, I've been experiencing this for quite some time and some googling shows others are too, but I haven't been able to figure out how to solve it.

I believe this is actually not specifically a darkice problem, but possibly in the way darkice uses the lame encoder for mp3 format. Darkice -> icecast2 works great if the feed has constant audio. However, if there is silence in it, that causes the feed to build lag in, and it grows beyond what the silence actually is. E.g. if there is a song, then 10 seconds of silence, then another song, you'll actually get the song, 20 seconds of silence, then the next song when listening via the client. If there are several periods of silence over the course of a day, your feed may end up 20+ minutes behind "real time".

It's not specifically a server problem, however. If you close the client and reopen the feed, you'll be back to realtime. It's not like I have to go back in and restart the icecast server. So it's not the server getting behind, it's that the server is sending excessive amounts of "empty" audio to the client, and the client just has to trudge through it.

So why would we care about silence anyway? Well the use case here is monitoring a ham radio frequency (for storm spotter reports). Most of the time it's going to be dead air. But if I start the feed (in my client) in the morning, if a storm happens at noon, my feed is already going to be well behind. I'd love if there was a way to keep the feed always on and get it without that growing "out of time" lag.

There is some discussion on the exact issue here:
https://mixxx.discourse.group/t/silence-in-streaming-icecast-expand-50-longer-than-played/18477/5

But that's for something else, and it's for ogg. But it's the same issue I'm seeing. Is there a way to have darkice NOT send the empty mp3 audio as 0kb? That sounds like it might fix the problem?

Sure, but I can't get it to paste right in here, I'll link to paste bin.

The icecast.xml is the default config:
https://pastebin.com/hFRVbugy

This is the darkice.cfg I have right now:
https://pastebin.com/BrjqEeZA

If it matters, this is currently running on Xubuntu 18.04