Problems with Web Streams
  • Hi folks...

    I'm having trouble with using Web Streams. They don't work in playout. I see in the ls_script.log that Airtime is retrying the stream when it's scheduled to play. I've tried a number of them. When I use the same URLs in simple liquidsoap transcoder scripts, they work fine (see below); so the sources and the URLs I'm using are OK.

    If I preview the stream in the library, or anywhere else Airtime lets you preview it, the stream(s) play out fine.

    The work-around that's been working for me operationally is to use short liquidsoap scripts to catch the stream and transcode to an Airtime DJ input. This way, when the times up, Airtime moves on and liquidsoap handles being disconnected from Airtime pretty well, although it retries every 3 seconds (is that adjustable somewhere?)

    This is a pretty important feature for me, but I'm not really sure how to proceed in this particular situation.
  • 5 Comments sorted by
  • There appears to be something odd with the Liquidsoap handling of http.input for webstreams that are mono when it expects stereo. I've had liquidsoap consuming up the total percentage.
    http://dev.sourcefabric.org/browse/LS-631

    So I reported a bug here  http://dev.sourcefabric.org/browse/CC-4760

    The error I get in my /var/log/airtime/pypo-liquidsoap/ls_script.log
    before it crashes is [http:3] Incorrect stream type!

    Did you have a similar error ?
  • Mono webstreams should work. Not sure if that is the problem.


    Can you post the url of a stream that doesn't work for you? Also, perhaps you somehow have an older version of Liquidsoap installed? What is the output of

    dpkg -l | grep liquidoap
    Airtime Pro Hosting: http://airtime.pro
  • foo@bar:~$ dpkg -l | grep liquidsoap
    ii  liquidsoap                        1.0.1~precise~sfo-4          audio streaming language
    foo@bar:~$

    note that there are no plugins!?  -- this is on a fresh Ubuntu 12.04 LTS server install with little else than Airtime loaded on it, and it's not used for any other purpose so it's squeaky clean.

    @Robbt - yes, I get the same thing in the same instance (mono vs. stereo)

    2012/12/27 15:20:11 [http:3] Incorrect stream type!

    Again, though, I have a number of "web streams" defined in the library that check out in preview mode right before and right after Airtime fails to play them out.

    Other log observations:

    2012/12/29 00:15:01 [main:2]
    2012/12/29 00:15:01 [main:2] DISCLAIMER: This version of Liquidsoap has been
    2012/12/29 00:15:01 [main:2] compiled from a snapshot of the development code.
    2012/12/29 00:15:01 [main:2] As such, it should not be used in production
    2012/12/29 00:15:01 [main:2] unless you know what you are doing!
    2012/12/29 00:15:01 [main:2]
    2012/12/29 00:15:01 [main:2] We are, however, very interested in any feedback
    2012/12/29 00:15:01 [main:2] about our development code and committed to fix
    2012/12/29 00:15:01 [main:2] issues as soon as possible.
    2012/12/29 00:15:01 [main:2]
    2012/12/29 00:15:01 [main:2] If you are interested in collaborating to
    2012/12/29 00:15:01 [main:2] the development of Liquidsoap, feel free to
    2012/12/29 00:15:01 [main:2] drop us a mail at <savonet-devl@lists.sf.net>
    2012/12/29 00:15:01 [main:2] or to join the #savonet IRC channel on Freenode.
    2012/12/29 00:15:01 [main:2]
    2012/12/29 00:15:01 [main:2] Please send any bug report or feature request
    2012/12/29 00:15:01 [main:2] at <http://dev.sourcefabric.org/browse/LS>.
    2012/12/29 00:15:01 [main:2]
    2012/12/29 00:15:01 [main:2] We hope you enjoy this snapshot build of Liquidsoap!
    2012/12/29 00:15:01 [main:2]
    2012/12/29 00:15:01 [dynamic.loader:3] Could not find dynamic module for aacplus encoder.
    I'm assuming that the "warning message" is to be expected...

    Now, that last line could explain one problem... what is the recommended fix for that?
    (I feel a little blind without ye olde Synaptic Package Manager)

    This (aacplus encoder, et. al.) may be an overlooked quasi-dependency... (that should be considered a dependency if Airtime is to support a reasonable range of "web stream" types)?

    Another interesting extract:

    2012/12/29 00:15:01 [protocols.external:3] Didn't find "ufetch".
    2012/12/29 00:15:01 [protocols.external:3] Found "/usr/bin/wget".
    2012/12/29 00:15:01 [main:3] Liquidsoap 1.0.1+scm

    Since I couldn't find anything else obvious in the log file, I created a test scenario that duplicates the problem.

    Web Stream URL and Info copied and pasted from Airtime's library right-click pop-up:

    KCFR - CPR
    Name:
    KCFR - CPR
    Length:08:30:00

    Creator:admin

    Description:KCFR CPR - Colorado Public Radio




    This is the log data from the event (scheduled for 12:40) where Airtime tries and fails (ls_script.log):

    2012/12/30 12:40:09 [server:3] New client: localhost.localdomain.
    2012/12/30 12:40:09 [lang:3] streams.scheduled_play_start
    2012/12/30 12:40:09 [lang:3] dynamic_source.output_start
    2012/12/30 12:40:09 [lang:3] /usr/lib/airtime/pypo/bin/liquidsoap_scripts/notify.sh --data='0' --media-id=-1 &
    2012/12/30 12:40:09 [server:3] Client localhost.localdomain disconnected.
    pypo.log (hopefully this is of use... I left out a couple of lines that were extremely verbose, and didn't seem relevant, if you need 'em I can past 'em in too):

    2012-12-29 00:12:40,795 INFO - [api_client.py : get_bootstrap_info() : line 672] - Bootstrap info retrieved {u'transition_fade': u
    '01.000', u'station_name': u'Radio Station Name', u'stream_label': u'2', u'switch_status': {u'scheduled_play': u'on', u'live_dj': u'off
    ', u'master_dj': u'off'}}
    2012-12-29 00:12:40,795 DEBUG - [pypofetch.py : set_bootstrap_variables() : line 184] - info:{u'transition_fade': u'01.000', u'sta
    tion_name': u'Radio Station Name', u'stream_label': u'2', u'switch_status': {u'scheduled_play': u'on', u'live_dj': u'off', u'master_dj'
    : u'off'}}
    2012-12-29 00:12:40,795 DEBUG - [pypofetch.py : switch_source() : line 148] - Switching source: scheduled_play to "on" status
    2012-12-30 12:40:00,001 DEBUG - [pypofetch.py : disconnect_source() : line 128] - Disconnecting source: live_dj
    2012-12-30 12:40:00,001 ERROR - [pypofetch.py : disconnect_source() : line 142] - [Errno 111] Connection refused
    2012-12-30 12:40:00,001 DEBUG - [pypopush.py : get_next_schedule_chain() : line 413] - tnow 2012-12-30 19:40:00.001482, chain_star
    t 2012-12-30 19:40:00
    ... [multiple duplicate messages]...
    2012-12-30 12:40:00,002 DEBUG - [pypopush.py : main() : line 129] - Blocking 0 seconds until show start
    2012-12-30 12:40:00,002 ERROR - [pypopush.py : start_web_stream() : line 514] - [Errno 111] Connection refused
    2012-12-30 12:40:00,002 DEBUG - [pypopush.py : get_next_schedule_chain() : line 413] - tnow 2012-12-30 19:40:00.002608, chain_star
    t 2012-12-30 19:59:59
    ... [multiple duplicate messages]...
    2012-12-30 12:40:00,003 DEBUG - [pypopush.py : main() : line 129] - Blocking 1198.996611 seconds until show start
    2012-12-30 12:40:08,911 INFO - [pypofetch.py : handle_message() : line 79] - Received event from Pypo Message Handler: {"event_typ
    e":"reset_liquidsoap_bootstrap"}
    2012-12-30 12:40:08,911 INFO - [pypofetch.py : handle_message() : line 83] - Handling command: reset_liquidsoap_bootstrap
    2012-12-30 12:40:08,911 DEBUG - [pypofetch.py : set_bootstrap_variables() : line 178] - Getting information needed on bootstrap fr
    om Airtime
    2012-12-30 12:40:09,043 INFO - [api_client.py : get_bootstrap_info() : line 672] - Bootstrap info retrieved {u'transition_fade': u
    '01.000', u'station_name': u'Radio Station Name', u'stream_label': u'2', u'switch_status': {u'scheduled_play': u'on', u'live_dj
    ': u'off', u'master_dj': u'off'}}
    2012-12-30 12:40:09,043 DEBUG - [pypofetch.py : set_bootstrap_variables() : line 184] - info:{u'transition_fade': u'01.000', u'sta
    tion_name': u'Radio Station Name', u'stream_label': u'2', u'switch_status': {u'scheduled_play': u'on', u'live_dj': u'off', u'ma
    ster_dj': u'off'}}
    2012-12-30 12:40:09,043 DEBUG - [pypofetch.py : switch_source() : line 148] - Switching source: scheduled_play to "on" status
    2012-12-30 12:40:09,044 DEBUG - [pypofetch.py : switch_source() : line 148] - Switching source: live_dj to "off" status
    2012-12-30 12:40:09,045 DEBUG - [pypofetch.py : switch_source() : line 148] - Switching source: master_dj to "off" status
    2012-12-30 12:40:09,046 INFO - [pypofetch.py : update_liquidsoap_stream_format() : line 388] - vars.stream_metadata_type 2
    2012-12-30 12:40:09,046 INFO - [pypofetch.py : update_liquidsoap_station_name() : line 417] - 127.0.0.1
    2012-12-30 12:40:09,046 INFO - [pypofetch.py : update_liquidsoap_station_name() : line 418] - 1234
    2012-12-30 12:40:09,046 INFO - [pypofetch.py : update_liquidsoap_station_name() : line 424] - vars.station_name Radio Station Name
    -FM
    2012-12-30 12:40:09,047 INFO - [pypofetch.py : update_liquidsoap_transition_fade() : line 404] - vars.default_dj_fade 01.000
    2012-12-30 12:40:09,048 INFO - [pypofetch.py : handle_message() : line 118] - New timeout: 1420.86329699
    2012-12-30 12:40:09,048 INFO - [pypofetch.py : main() : line 523] - Loop #2954
    ...[bunch of extremely verbose stuff]...
    2012-12-30 12:40:09,049 DEBUG - [pypofetch.py : process_schedule() : line 474] - Pushing to pypo-push
    2012-12-30 12:40:09,049 DEBUG - [pypofetch.py : cache_cleanup() : line 499] - Files to remove set([])
    2012-12-30 12:40:09,049 INFO - [pypofetch.py : handle_message() : line 118] - New timeout: 1800
    2012-12-30 12:40:09,049 INFO - [pypofetch.py : main() : line 523] - Loop #2955
    2012-12-30 12:40:09,095 DEBUG - [pypopush.py : get_current_chain() : line 390] - tnow 2012-12-30 19:40:09.095620, chain_start 2012
    -12-30 19:39:55
    2012-12-30 12:40:09,097 DEBUG - [pypopush.py : handle_new_schedule() : line 236] - [{u'end': u'2012-12-30-20-00-00', u'show_name':
     u'KCFR Test', u'uri': u'http://173.192.70.140:7392/stream/1/', u'start': u'2012-12-30-19-40-00', u'independent_event': True, u'ro
    w_id': 214, u'type': u'stream_output_start', u'id': 9}]
    2012-12-30 12:40:09,097 DEBUG - [pypopush.py : is_correct_current_item() : line 216] - Is current item correct?: False
    2012-12-30 12:40:09,097 DEBUG - [pypopush.py : remove_from_liquidsoap_queue() : line 607] - source.skip
    2012-12-30 12:40:09,097 DEBUG - [pypopush.py : remove_from_liquidsoap_queue() : line 629] - queue.queue
    2012-12-30 12:40:09,098 DEBUG - [pypopush.py : remove_from_liquidsoap_queue() : line 633] - Not skipped
    2012-12-30 12:40:09,098 DEBUG - [pypopush.py : stop_web_stream_all() : line 525] - http.stop
    2012-12-30 12:40:09,098 DEBUG - [pypopush.py : stop_web_stream_all() : line 529] - dynamic_source.output_stop
    2012-12-30 12:40:09,098 DEBUG - [pypopush.py : stop_web_stream_all() : line 533] - dynamic_source.id -1
    2012-12-30 12:40:09,098 DEBUG - [pypopush.py : stop_web_stream_all() : line 537] - Done
    2012-12-30 12:40:09,098 DEBUG - [pypopush.py : start_web_stream() : line 506] - dynamic_source.output_start
    2012-12-30 12:40:31,300 DEBUG - [pypopush.py : start_web_stream() : line 510] - Done.
    2012-12-30 12:40:31,300 DEBUG - [pypopush.py : get_next_schedule_chain() : line 413] tnow 2012-12-30 19:40:09.095620, chain_star t 2012-12-30 19:39:55
    2012-12-30 12:40:31,301 DEBUG - [pypopush.py : get_next_schedule_chain() : line 413] - tnow 2012-12-30 19:40:09.095620, chain_star
    t 2012-12-31 13:59:59
    2012-12-30 12:40:31,301 DEBUG - [pypopush.py : main() : line 104] - Next schedule chain: [{u'end': u'2012-12-30-19-59-59', u'uri':
     u'http://173.192.70.140:7392/stream/1/', u'start': u'2012-12-30-19-59-59', u'row_id': 214, u'type': u'stream_buffer_end', u'indep
    endent_event': True}]
    2012-12-30 12:40:31,302 DEBUG - [pypopush.py : main() : line 113] - Blocking 1167.697866 seconds until show start
    so it fails, and then goes on to queue up the next web stream (LRN.fm) which also failed.


    Random feature request alert: Easily accessible Meta-Data update to make it easy to manually remediate a lingering incorrect datum.







    Post edited by Rex Latchford at 2012-12-30 15:03:25
  • This appears to be a Liquidsoap bug.

    You can reproduce from command-line simply by running the following:

    liquidsoap /usr/lib/airtime/pypo/bin/liquidsoap_scripts/library/pervasives.liq 'output.alsa(mksafe(input.http("http://173.192.70.140:7392/stream/1/")))'

    I'll open a ticket with the Liquidsoap team.
    Airtime Pro Hosting: http://airtime.pro
  • Hi Martin! Kudos on the awesome job you do here... I saw your post about this (mono vs. stereo issue?) on the liquidsoap mail list.

    I'm having the same problem as Rex. Very similar config - latest version of Airtime with Ubuntu 12.04LTS. Web Streams simply don't work on my installation. I can't figure out why. They preview fine.

    I've modified my ls_script.liq so that if nothing is scheduled, a fallback stream is played:

    #default = amplify(id="silence_src", 0.00001, noise())
    default =  mksafe(input.http("http://otherfeed.net:1234/mount"))
    This works MOST of the time, and when it doesn't, I give airtime-liquidsoap a kick, and it takes off...
    sudo /usr/bin/service airtime-liquidsoap restart

    HOWEVER.... If I have scheduled a Web Stream, when the Web Stream tries to start up (even though it wouldn't work anyway with the stock ls_script.liq), airtime-liquidsoap hangs in that the service restart (above) doesn't work. In this case, I have to send airtime-liquidsoap a -QUIT signal. Then I can use .../service airtime-liquidsoap start to get it going again.
    $ sudo /usr/sbin/service airtime-liquidsoap restart
    Restarting Liquidsoap: Traceback (most recent call last):
      File "/usr/lib/airtime/pypo/bin/liquidsoap_scripts/liquidsoap_prepare_terminate.py", line 14, in <module>
        tn.read_all()
      File "/usr/lib/python2.7/telnetlib.py", line 325, in read_all
        self.fill_rawq()
      File "/usr/lib/python2.7/telnetlib.py", line 516, in fill_rawq
        buf = self.sock.recv(50)
    # [ it hangs here, to it's ctrl-C time... ]
    KeyboardInterrupt
    $ # [kill -QUIT {PID}
    $ /usr/sbin/service airtime-liquidsoap restart
    $# ...

    Perhaps this factoid can help solve the problem as to why Web Streams aren't working at all in my install and Rex's install.

    My solution for now is to set up a user (DJ) for each URL I want to use as a Web Stream. Then, I schedule a show, and set it up to be fed by the DJ associated with the desired URL. I then run the following liquidsoap script on another box (using liquidsoap 0.92, note syntax difference, which really confused me at first):
    input = mksafe(input.http("http://stream.org:1234"))
    output.icecast.vorbis.cbr( samplerate=44100,
            stereo=true,
            user="user",
            password="password",
             mount="Remote",
      host="myhost.org", port=8xxx,
      input)

    I'm having trouble with the liquidsoap learning curve, especially since the 0.92 and 1.x versions are so different. I plan to set up another box to load Airtime onto so I can focus on the version that is bundled in Airtime. Hopefully that will help me with troubleshooting Airtime issues and integrating Airtime better with liquidsoap?

    - gtron