savonet / liquidsoap

Liquidsoap is a statically typed scripting general-purpose language with dedicated operators and backend for all thing media, streaming, file generation, automation, HTTP backend and more.
http://liquidsoap.info
GNU General Public License v2.0
1.4k stars 128 forks source link

Streaming Icecast unstable bitrate with mp3 CBR coder #179

Closed nfavrod closed 9 years ago

nfavrod commented 10 years ago

I have a problem streaming a playlist with liquidsoap (both in airtime and liquidsoap standalone).

output.icecast(%mp3(bitrate = 256, stereo = true), ... ) stream to an external icecast but the coder is very unstable. It bursts a lot more than 300kbps, and it makes the stream drop some packets and cut very often. I use a professional codec (Barix like) to receive this stream and even with a big buffer, it drops a lot of packets.

When I encode the stream with Darkice, the stream is very stable. I don't have the variations. The CBR coder doesn't variate more than 5kbps. It's much more stable.

I also tried to use VBR ( %mp3.vbr(quality=3) ) and it's a little better but it's not perfect either.

Can you tell me a little more how liquidsoap encodes and check if the processing could be improved?

toots commented 10 years ago

Hi,

The encoding code is there: https://github.com/savonet/liquidsoap/blob/master/src/encoder/lame_encoder.ml#L163 and in the lame binding: https://github.com/savonet/ocaml-lame

As far as I can tell, we use the lame library quite straightforwardly, setting initial parameters then passing data down to the encoder and reading out encoded data..

Do you have an encoded file to share so we can look at it? Also, have you tried with the %shine encoder?

dbaelde commented 9 years ago

I'll close as incomplete due to inactivity. Feel free to reopen.