[Flac-dev] OggFLAC streaming is systemically broken.

Brian Willoughby brianw at sounds.wa.com
Wed Dec 1 13:15:27 PST 2010


Thanks for looking into things like this.  Streaming 24-bit FLAC  
seems like a great idea.

P.S.  Rather than resorting to something esoteric like plugging in an  
old AM radio, perhaps you could use a more prevalent audio process  
like dithering (maybe even with noise shaping) to produce non-zero  
frames - assuming your hack continues to be necessary.  Depending  
upon the source of your audio, there's a slight chance that dithering  
would be beneficial anyway.

Brian Willoughby
Sound Consulting


On Dec 1, 2010, at 01:28, David Richards wrote:
> I am streaming FLAC. 24bit no less, and its fantastic. The future I
> would like to live in, is one where lossless music is streamed and
> heard by people other than myself.
>
> It is generally not possible to stream flac correctly with the current
> libflac 1.2.1, unless your into epic kludges. There is at-least one
> issue in libflac, and issues in decoding clients such as VLC, mplayer
> and totem.
>
> The good news is that one can hackfix libflac on the server side and
> produce a valid stream that VLC and mplayer can take in without issue.
> Totem seems to have other issues I have not investigated.
>
> There seems to be two problems conspiring together. Both have to do
> with silence. Even though what we really want to do is listen to music
> or someone yapping, silence manages to be very important, be it a few
> second in a song or long periods of dead air. Problem number one that
> when libflac is pumping out silent subframes, the ogg pages are never
> getting flushed out, because they are so small. So until there is some
> noise or the page is full, the client decoder is left hanging. Then
> when it starts decoding again, its decoding silence, and thus falls
> far behind in the stream, probably confusing itself and disconnecting.
> Problem number two, is even if you flush these little guys.. the
> clients still get confused, especially if there is more than one per
> page.
>
> The epic kludge solution is to just never let there be any perfect
> silence, not even for a few ms, plug in an old am radio and crank it
> to just barely audible and add that to the stream.
>
> The hackfix, is to disable constant subframes, and flush any packet
> less than say 700 bytes, otherwise use pageout as normal.
>
> The sustainable solution would probably be to add an option to libflac
> to force flush the stream after X number of samples, and then fix all
> of the clients. Then live the dream of streaming lossless audio.




More information about the Flac-dev mailing list