IPB

Welcome Guest ( Log In | Register )

Streaming FLAC over the Internet, Split from "The Future of FLAC"
andrewfg
post Nov 22 2012, 12:06
Post #1





Group: Members
Posts: 84
Joined: 12-May 08
Member No.: 53478



IMHO flac has one technical weakness that will prevent it taking off as THE standard -- namely it only has Variable Bit Rate compression algorithms. Which means that one cannot predict in advance the length of ouput file that will be generated for any input stream.

This is a problem when you want to transcode another format of audio file to flac and stream it over Http. The Http protocol requires sending a Content Length (number of bytes) header at the start of the streaming process. With flac you cannot know the number of bytes until after the full file has been transcoded. So this means that Http must either wait until the full transcoding has been completed, or alternatively if it wants to start streaming the data immediately, then it must provide some guessed value in its Content Length header (and this is not conformant to the Http specifications, and may cause problems in some music players...)

By contrast, if you are (say) transcoding to mp3 and streaming that via Http, then the transcoder can select a Constant Bit Rate compression algorithm. And in such a case, the Http Content Length is easily calculated in advance as being the input audio file's duration (in seconds) multiplied by the CBR rate (in bytes per second).

So if the flac standard were extended to allow both the existing Variable Bit Rate compression algorithm plus a new Constant Bit Rate option, then it would become much better suited for online streaming.

This post has been edited by andrewfg: Nov 22 2012, 12:07


--------------------
AndrewFG (Whitebear -- http://www.whitebear.ch/mediaserver )
Go to the top of the page
+Quote Post
 
Start new topic
Replies
Nekit1234007
post Nov 22 2012, 12:45
Post #2





Group: Members
Posts: 12
Joined: 26-February 12
Member No.: 97404



QUOTE (andrewfg @ Nov 22 2012, 15:06) *
The Http protocol requires sending a Content Length (number of bytes) header

Since when? I canít speak for streaming media over HTTP, but regular data doesnít require it. Also some radio stations provide flac streams.
Go to the top of the page
+Quote Post
andrewfg
post Nov 22 2012, 22:31
Post #3





Group: Members
Posts: 84
Joined: 12-May 08
Member No.: 53478



QUOTE (Nekit1234007 @ Nov 22 2012, 12:45) *
Since when? I canít speak for streaming media over HTTP, but regular data doesnít require it. Also some radio stations provide flac streams.


I am speaking of UPnP / DLNA audio renderers. If you don't provide a Content Length, then the player cannot support Seek.




--------------------
AndrewFG (Whitebear -- http://www.whitebear.ch/mediaserver )
Go to the top of the page
+Quote Post
[JAZ]
post Nov 23 2012, 21:17
Post #4





Group: Members
Posts: 1779
Joined: 24-June 02
From: Catalunya(Spain)
Member No.: 2383



QUOTE (andrewfg @ Nov 22 2012, 22:31) *
I am speaking of UPnP / DLNA audio renderers. If you don't provide a Content Length, then the player cannot support Seek.


We mostly agree, but now think about this. If the DLNA renderer allows the user to seek your realtime-generated stream, what will you do if the user seeks backwards?
Also, depending on the DLNA server/renderer, the content might be fully "downloaded" before it starts to play.
Go to the top of the page
+Quote Post
andrewfg
post Nov 24 2012, 00:09
Post #5





Group: Members
Posts: 84
Joined: 12-May 08
Member No.: 53478



QUOTE ([JAZ] @ Nov 23 2012, 21:17) *

... now think about this. If the DLNA renderer allows the user to seek your realtime-generated stream, what will you do if the user seeks backwards?


That is absolutely no problem. The server can always seek backwards to an earlier time offset in its cache of what has already been transcoded. It is actually a bit more difficult to seek forwards: In such a case, the server obviously cannot seek forward into a not yet transcoded cache. Instead the server needs to abandon the current running transcoder process and start another transcoder process starting at a forward time offset into the original source file.

This can only work if the server has given a reasonably accurate Content Length value: If the user seeks to (say) half way through the file, then the renderer makes a Byte-Range seek to Content Length x 0.5. Obviously if Content Length is not existing then this cannot work. And if the provided Content Length is wildly inaccurate then the seek may not end up in the expected place. And if the provided Content Length is way too long, then the seek may end up trying to go beyond the end of the final transcoded actual file...

QUOTE ([JAZ] @ Nov 23 2012, 21:17) *

Also, depending on the DLNA server/renderer, the content might be fully "downloaded" before it starts to play.


If the renderer has fully downloaded the track, then indeed it has full knowledge about the actual track length, so it can process seek requests accurately. However most users are not willing to wait until a track has fully downloaded before starting to play it. This therefore requires a predictive approach towards the seek algorithm. And this is why I think that flac needs to provide a predictive method of estimating a Content Length before the full file has actually been transcoded...

This post has been edited by andrewfg: Nov 24 2012, 00:13


--------------------
AndrewFG (Whitebear -- http://www.whitebear.ch/mediaserver )
Go to the top of the page
+Quote Post

Posts in this topic
- andrewfg   Streaming FLAC over the Internet   Nov 22 2012, 12:06
- - greynol   QUOTE (andrewfg @ Nov 22 2012, 03:06) IMH...   Nov 22 2012, 12:15
|- - andrewfg   QUOTE (greynol @ Nov 22 2012, 12:15) Name...   Nov 22 2012, 12:19
|- - [JAZ]   QUOTE (andrewfg @ Nov 22 2012, 12:19) It ...   Nov 22 2012, 19:24
|- - andrewfg   QUOTE ([JAZ] @ Nov 22 2012, 19:24...   Nov 22 2012, 22:35
- - 2Bdecided   By definition, lossless compressed formats can...   Nov 22 2012, 12:26
|- - andrewfg   QUOTE (2Bdecided @ Nov 22 2012, 12:26) By...   Nov 22 2012, 22:28
||- - Porcus   QUOTE (andrewfg @ Nov 22 2012, 22:28) QUO...   Nov 22 2012, 23:49
||- - Soap   QUOTE (andrewfg @ Nov 22 2012, 17:28) QUO...   Nov 23 2012, 00:19
||- - andrewfg   QUOTE (Soap @ Nov 23 2012, 00:19) You can...   Nov 23 2012, 23:49
||- - Porcus   QUOTE (andrewfg @ Nov 23 2012, 23:49) Nev...   Nov 24 2012, 02:20
||- - Soap   QUOTE (andrewfg @ Nov 23 2012, 18:49) ......   Nov 24 2012, 03:44
||- - andrewfg   QUOTE (Soap @ Nov 24 2012, 03:44) Congrat...   Nov 24 2012, 14:52
|- - funkyblue   QUOTE (2Bdecided @ Nov 22 2012, 21:26) By...   Nov 23 2012, 10:45
|- - Porcus   QUOTE (funkyblue @ Nov 23 2012, 10:45) Wh...   Nov 23 2012, 11:00
|- - funkyblue   QUOTE (Porcus @ Nov 23 2012, 20:00) QUOTE...   Nov 23 2012, 11:19
|- - includemeout   QUOTE (Porcus @ Nov 23 2012, 12:00) (...)...   Nov 23 2012, 22:28
|- - funkyblue   QUOTE (Porcus @ Nov 23 2012, 20:00) QUOTE...   Nov 24 2012, 00:20
|- - andrewfg   QUOTE (funkyblue @ Nov 24 2012, 00:20) Fo...   Nov 24 2012, 00:30
|- - Wombat   QUOTE (andrewfg @ Nov 24 2012, 01:30) I a...   Nov 24 2012, 00:39
- - Nekit1234007   QUOTE (andrewfg @ Nov 22 2012, 15:06) The...   Nov 22 2012, 12:45
|- - andrewfg   QUOTE (Nekit1234007 @ Nov 22 2012, 12:45)...   Nov 22 2012, 22:31
|- - [JAZ]   QUOTE (andrewfg @ Nov 22 2012, 22:31) I a...   Nov 23 2012, 21:17
|- - andrewfg   QUOTE ([JAZ] @ Nov 23 2012, 21:17...   Nov 24 2012, 00:09
- - Porcus   If this is still relevant after [JAZ]'s clarif...   Nov 22 2012, 19:48
|- - andrewfg   QUOTE (Porcus @ Nov 22 2012, 19:48) FLAC ...   Nov 22 2012, 22:37
- - funkyblue   It is an option in dBpoweramp. http://www.audiost...   Nov 24 2012, 00:38
- - greynol   QUOTE (andrewfg @ Nov 23 2012, 14:49) If ...   Nov 24 2012, 00:58
|- - andrewfg   QUOTE (greynol @ Nov 24 2012, 00:58) Desp...   Nov 24 2012, 14:04
|- - Soap   QUOTE (andrewfg @ Nov 24 2012, 09:04) I w...   Nov 24 2012, 14:21
|- - andrewfg   QUOTE (Soap @ Nov 24 2012, 14:21) You men...   Nov 24 2012, 18:22
|- - greynol   QUOTE (andrewfg @ Nov 24 2012, 09:22) if ...   Nov 24 2012, 18:32
|- - tuffy   QUOTE (andrewfg @ Nov 24 2012, 12:22) The...   Nov 24 2012, 18:48
|- - Soap   QUOTE (andrewfg @ Nov 24 2012, 12:22) No....   Nov 24 2012, 19:20
|- - andrewfg   QUOTE (Soap @ Nov 24 2012, 19:20) That is...   Nov 25 2012, 01:10
|- - Soap   QUOTE (andrewfg @ Nov 24 2012, 19:10) Act...   Nov 25 2012, 01:29
- - funkyblue   I realise that but the link posted a bunch of cryp...   Nov 24 2012, 01:10
- - 73ChargerFan   Seeking - store a seek table in the header, say fo...   Nov 24 2012, 02:02
- - greynol   You pad and your compression goes out the window. ...   Nov 24 2012, 03:51
- - saratoga   I guess in principle you'd have to pad for at ...   Nov 24 2012, 03:55
- - greynol   If you could manage to ensure that the only data t...   Nov 24 2012, 04:00
- - Porcus   Well if you are encoding the signal in advance, yo...   Nov 24 2012, 11:36
|- - greynol   QUOTE (Porcus @ Nov 24 2012, 02:36) Well ...   Nov 24 2012, 15:24
|- - Porcus   QUOTE (greynol @ Nov 24 2012, 15:24) QUOT...   Nov 25 2012, 01:15
- - greynol   @andrewfg: Read my edit.   Nov 24 2012, 18:48
- - greynol   Axon posted a script to generate histograms and in...   Nov 25 2012, 05:39
|- - Axon   QUOTE (greynol @ Nov 24 2012, 22:39) AFAI...   Nov 25 2012, 06:34
- - 2Bdecided   I knew I should have brought popcorn.   Nov 26 2012, 14:09


Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 2nd September 2014 - 04:15