Liquidsoap 1.1.1 : External streams


You can use an external program to create a source that will read data coming out of the standard output (stdout) of this program. Contrary to the external file decoders, data will be buffered and played when a sufficient amount was accumulated.

The program should output data in signed 16 bits little endian PCM (s16le). Number of channels and samplerate can be specified. There is no need of any wav header in the data, though it should work too.

Basic operator

The basic operator for creating an external stream is input.external. Its parameters are:

The last parameter is unlabeled. It is a string containing the command that will be executed to run the external program.


A wrapper, input.mplayer, is defined to use mplayer as the external decoder. Its code is:

# Stream data from mplayer
# @category Source / Input
# @param s data URI.
# @param ~restart restart on exit.
# @param ~restart_on_error restart on exit with error.
# @param ~buffer Duration of the pre-buffered data.
# @param ~max Maximum duration of the buffered data.
def input.mplayer(~id="input.mplayer",
         ~buffer=0.2,~max=10.,s) =
      "mplayer -really-quiet \
              -ao pcm:file=/dev/stdout \
              -vc null -vo null #{quote(s)} \
Grab the code!