On Sun, Feb 19, 2012 at 7:53 AM, David Baelde <[email protected]>wrote:
> Hi,
>
> 2012/2/19 John Paul Morrison <[email protected]>:
> > Now I'm trying to optimize, and wondering if there's a way liquidsoap can
> > disconnect the http source when there are no listeners, to save
> > bandwidth/cpu etc. and restart the source when a listener connects.
>
> If you really need input.http and output.icecast, then all you can do
> is setup hooks in icecast (I believe this is possible) and control the
> HTTP input from those hooks.
>
I need input.http to open the external web site that's in AAC. (My AVR
could talk to the radio station's MP3 stream directly but that stream is
much lower quality).
So you think an icecast2 server could directly open external http sources
and handle the transcoding with/without liquidsoap?
I used output.icecast because the AVR only has an http client.
>
> However, you may be able to use output.harbor() instead of
> output.icecast(). It's not as robust, but good enough for simple
> personal uses, or as an intermediate before going to icecast. Then you
> get on_connect and on_disconnect hooks directly in liquidsoap.
>
I thought output.harbor() initiated a connection to another server.
Is there some way for liquidsoap to implement a simple http server?
>
> There are also more advanced tricks where you create the harbor output
> on demand, which could mean (re)creating the http input on demand as
> well. But I don't have a reference in mind, and this is a too
> experimental anyway.
>
> > I'm also using liquidsoap with shairtunes to add Airplay support to the
> AVR.
> > input.external with dd (cat doesn't seem to work properly) reading from
> a
> > named pipe is doing the trick. It would be great if there were a way to
> use
> > single() to read from a named pipe instead of mksafe(input.external("dd
> > if=/tmp/pcm")).
>
> I'm sure this will be interesting for others. This might be worth a
> snippet on the wiki?
>
>
The liquidsoap part is simple at this point. Basically:
s = mksafe(input.external("dd if=/tmp/shairtunes.pcm 2>/dev/null")
output.icecast(%mp3(bitrate=320),host="localhost",port=8000,password="hackme",fallible=true,mount="Shairport",s)
I'm not 100% sure that dd is better than cat, because I spent a while
banging my head on the shairtunes perl script which has buggy pipe output.
But dd does seem to behave a bit better with exiting, while cat would just
block on the fifo and wouldn't die properly.
I ended up hacking the latest shairtunes.c to write directly to a file.
Then I would do:
mkfifo /tmp/shairtunes.pcm
shairtunes -d
liquidsoap -d shairtunes.liq
Shairtunes.c and/or avahi is a little buggy right now - iTunes doesn't
always connect properly, and my direct file output hack is just for testing
(no error handling). Still it's pretty usable at the moment - iTunes will
stream to shairtunes and icecast will serve it to the AVR. There's about
10-20 seconds buffering, possibly in shairtunes but most likely in icecast
and the AVR so there's lag in the control fro iTunes - changing tracks and
stopping playback isn't instant.
> I didn't know that dd worked better than cat, but it's probably a
> buffering issue. Regarding using named pipes for single(), I have no
> objection except that, if it works with input.external, that's good
> enough for me, possibly with a wrapper in the standard library. What
> doesn't work in your attempts with single()?
>
single() does too much error checking on the file so if I do:
mkfifo /tmp/shairtunes.pcm
then run liquidsoap with:
s = single("/tmp/test.pcm")
I get:
Could not get a valid media file of kind {audio=2;video=0;midi=0} from
"/tmp/test.pcm".
I get around it with the mksafe and input.external with dd/cat
input.file() would be handy, if it could directly read a regular file, pipe
or stdin.
So if the writer of the pipe dies/restarts, mksafe() could skip over it and
try later.
BTW are there any debugging or stats in liquidsoap that can be displayed
for for an input stream? e.g. clocking issues, missing samples etc.
thanks
> Cheers,
> --
> David
>
>
------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
Savonet-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/savonet-users