Liquidsoap Audio & Video Streaming Language 1 / 73 What is - - PowerPoint PPT Presentation

liquidsoap
SMART_READER_LITE
LIVE PREVIEW

Liquidsoap Audio & Video Streaming Language 1 / 73 What is - - PowerPoint PPT Presentation

Liquidsoap Audio & Video Streaming Language 1 / 73 What is Liquidsoap? 2 / 73 What is Liquidsoap? A language to create audio and video streams 3 / 73 What is Liquidsoap? A language to create audio and video streams myplaylist =


slide-1
SLIDE 1

Liquidsoap

Audio & Video Streaming Language 1 / 73

slide-2
SLIDE 2

What is Liquidsoap?

2 / 73

slide-3
SLIDE 3

What is Liquidsoap?

A language to create audio and video streams 3 / 73

slide-4
SLIDE 4

What is Liquidsoap?

A language to create audio and video streams

myplaylist = playlist("~/radio/music.m3u") jingles = playlist("~/radio/jingles.m3u") radio = myplaylist radio = random(weights = [1, 4],[jingles, radio])

  • utput.icecast(%mp3,

host = "localhost", port = 8000, password = "hackme", mount = "basic-radio", radio)

4 / 73

slide-5
SLIDE 5

What is Liquidsoap?

A language to create audio and video streams

myplaylist = playlist("~/radio/music.m3u") jingles = playlist("~/radio/jingles.m3u") radio = myplaylist radio = random(weights = [1, 4],[jingles, radio])

  • utput.icecast(%mp3,

host = "localhost", port = 8000, password = "hackme", mount = "basic-radio", radio)

Programming tools to help the user 5 / 73

slide-6
SLIDE 6

What is Liquidsoap?

A language to create audio and video streams

myplaylist = playlist("~/radio/music.m3u") jingles = playlist("~/radio/jingles.m3u") radio = myplaylist radio = random(weights = [1, 4],[jingles, radio])

  • utput.icecast(%mp3,

host = "localhost", port = 8000, password = "hackme", mount = "basic-radio", radio)

Programming tools to help the user Verifications of specific properties (i.e. "Can this source fail?") 6 / 73

slide-7
SLIDE 7

What is Liquidsoap?

A language to create audio and video streams

myplaylist = playlist("~/radio/music.m3u") jingles = playlist("~/radio/jingles.m3u") radio = myplaylist radio = random(weights = [1, 4],[jingles, radio])

  • utput.icecast(%mp3,

host = "localhost", port = 8000, password = "hackme", mount = "basic-radio", radio)

Programming tools to help the user Verifications of specific properties (i.e. "Can this source fail?")

At line 5, char 8-49: Error 7: Invalid value: That source is fallible

7 / 73

slide-8
SLIDE 8

What is Liquidsoap?

A language to create audio and video streams

myplaylist = playlist("~/radio/music.m3u") jingles = playlist("~/radio/jingles.m3u") security = single("~/radio/sounds/default.mp3") radio = myplaylist radio = random(weights = [1, 4],[jingles, radio]) radio = fallback(track_sensitive = false, [radio, security])

  • utput.icecast(%mp3,

host = "localhost", port = 8000, password = "hackme", mount = "basic-radio", radio)

Programming tools to help the user Verifications of specific properties (i.e. "Can this source fail?")

At line 5, char 8-49: Error 7: Invalid value: That source is fallible

8 / 73

slide-9
SLIDE 9

What is Liquidsoap?

A language to create audio and video streams

myplaylist = playlist("~/radio/music.m3u") jingles = playlist("~/radio/jingles.m3u") security = single("~/radio/sounds/default.mp3") radio = myplaylist radio = random(weights = [1, 4],[jingles, radio]) radio = fallback(track_sensitive = false, [radio, security])

  • utput.icecast(%mp3,

host = "localhost", port = 8000, password = "hackme", mount = "basic-radio", radio)

Programming tools to help the user Verifications of specific properties (i.e. "Can this source fail?")

At line 5, char 8-49: Error 7: Invalid value: That source is fallible

Static typing catered for its users (source media content, unused variables, etc..) 9 / 73

slide-10
SLIDE 10

What is Liquidsoap?

A language to create audio and video streams Dedicated time predicates: 1w12h 10 / 73

slide-11
SLIDE 11

What is Liquidsoap?

A language to create audio and video streams Dedicated time predicates: 1w12h

switch([ ({ 20h-22h30 }, prime_time), ({ 1w }, monday_source), ({ (6w or 7w) and 0h-12h }, week_ends_mornings), ({ true }, default_source) ])

11 / 73

slide-12
SLIDE 12

What is Liquidsoap?

A language to create audio and video streams Dedicated time predicates: 1w12h

switch([ ({ 20h-22h30 }, prime_time), ({ 1w }, monday_source), ({ (6w or 7w) and 0h-12h }, week_ends_mornings), ({ true }, default_source) ])

... 12 / 73

slide-13
SLIDE 13

A little history..

Founded in 2003 by David Baelde and Samuel Mimram 13 / 73

slide-14
SLIDE 14

A little history..

Founded in 2003 by David Baelde and Samuel Mimram Savonet: SAm and daVid Ocaml NETwork 🙃 14 / 73

slide-15
SLIDE 15

A little history..

Founded in 2003 by David Baelde and Samuel Mimram Savonet: SAm and daVid Ocaml NETwork 🙃 Originally a studet project at Ecole Normale Supérieure de Lyon 15 / 73

slide-16
SLIDE 16

A little history..

Founded in 2003 by David Baelde and Samuel Mimram Savonet: SAm and daVid Ocaml NETwork 🙃 Originally a studet project at Ecole Normale Supérieure de Lyon Purpose was to stream the music shared on the local SAMBA (windows) network to listen to music while coding 16 / 73

slide-17
SLIDE 17

A little history..

Founded in 2003 by David Baelde and Samuel Mimram Savonet: SAm and daVid Ocaml NETwork 🙃 Originally a studet project at Ecole Normale Supérieure de Lyon Purpose was to stream the music shared on the local SAMBA (windows) network to listen to music while coding Features: Indexing of shared music files, IRC bot with user-requests & Icecast streaming output 17 / 73

slide-18
SLIDE 18

A little history..

Founded in 2003 by David Baelde and Samuel Mimram Savonet: SAm and daVid Ocaml NETwork 🙃 Originally a studet project at Ecole Normale Supérieure de Lyon Purpose was to stream the music shared on the local SAMBA (windows) network to listen to music while coding Features: Indexing of shared music files, IRC bot with user-requests & Icecast streaming output Creating a new language emerged as part of the school's expected student project 18 / 73

slide-19
SLIDE 19

A little history..

Founded in 2003 by David Baelde and Samuel Mimram Savonet: SAm and daVid Ocaml NETwork 🙃 Originally a studet project at Ecole Normale Supérieure de Lyon Purpose was to stream the music shared on the local SAMBA (windows) network to listen to music while coding Features: Indexing of shared music files, IRC bot with user-requests & Icecast streaming output Creating a new language emerged as part of the school's expected student project OCaml! 19 / 73

slide-20
SLIDE 20

The liquidsoap language

20 / 73

slide-21
SLIDE 21

The liquidsoap language

Scripting language 21 / 73

slide-22
SLIDE 22

The liquidsoap language

Scripting language Functional language 22 / 73

slide-23
SLIDE 23

The liquidsoap language

Scripting language Functional language

input.harbor(on_connect=callback, ...)

23 / 73

slide-24
SLIDE 24

The liquidsoap language

Scripting language Functional language

input.harbor(on_connect=callback, ...)

Static & inferred types 24 / 73

slide-25
SLIDE 25

The liquidsoap language

Scripting language Functional language

input.harbor(on_connect=callback, ...)

Static & inferred types

source(audio=2, video=0, midi=0)

25 / 73

slide-26
SLIDE 26

The liquidsoap language

Scripting language Functional language

input.harbor(on_connect=callback, ...)

Static & inferred types

source(audio=2, video=0, midi=0) (..., format('a), source('a)) -> source('a)

26 / 73

slide-27
SLIDE 27

The liquidsoap language

Scripting language Functional language

input.harbor(on_connect=callback, ...)

Static & inferred types

source(audio=2, video=0, midi=0) (..., format('a), source('a)) -> source('a)

Labels and optiomal parameters 27 / 73

slide-28
SLIDE 28

The liquidsoap language

Scripting language Functional language

input.harbor(on_connect=callback, ...)

Static & inferred types

source(audio=2, video=0, midi=0) (..., format('a), source('a)) -> source('a)

Labels and optiomal parameters

def my_function(?optional_arg, ~labeled_arg, arg1, arg2) = ... end

28 / 73

slide-29
SLIDE 29

The liquidsoap language

Scripting language Functional language

input.harbor(on_connect=callback, ...)

Static & inferred types

source(audio=2, video=0, midi=0) (..., format('a), source('a)) -> source('a)

Labels and optiomal parameters

def my_function(?optional_arg, ~labeled_arg, arg1, arg2) = ... end my_function(arg1, arg2, labeled_arg="foo", optional_arg=123) my_function(arg1, arg2, labeled_arg="foo")

29 / 73

slide-30
SLIDE 30

The liquidsoap language

Scripting language: Self-documented 30 / 73

slide-31
SLIDE 31

The liquidsoap language

Scripting language: Self-documented

% liquidsoap -h input.srt Start a SRT agent in listener mode to receive and decode a stream. Type: (?id : string, ?bind_address : string, ?clock_safe : bool, ?content_type : string, ?dump : string, ?max : float, ?messageapi : bool, ?on_connect : ((unit) -> unit), ?on_disconnect : (() -> unit), ?payload_size : int, ?port : int) -> source('a) Category: Source / Input Parameters: * id : string (default: "") Force the value of the source ID. * bind_address : string (default: "0.0.0.0") Address to bind on the local machine. ...

31 / 73

slide-32
SLIDE 32

Some common features

32 / 73

slide-33
SLIDE 33

Some common features

Large set of supported audio and video codecs 33 / 73

slide-34
SLIDE 34

Some common features

Large set of supported audio and video codecs I/O 34 / 73

slide-35
SLIDE 35

Some common features

Large set of supported audio and video codecs I/O Alsa, portaudio, ao, etc.. 35 / 73

slide-36
SLIDE 36

Some common features

Large set of supported audio and video codecs I/O Alsa, portaudio, ao, etc.. File output 36 / 73

slide-37
SLIDE 37

Some common features

Large set of supported audio and video codecs I/O Alsa, portaudio, ao, etc.. File output HTTP, icecast, HLS, SRT, etc.. 37 / 73

slide-38
SLIDE 38

Some common features

Large set of supported audio and video codecs I/O Alsa, portaudio, ao, etc.. File output HTTP, icecast, HLS, SRT, etc.. Harbor (icecast) input 38 / 73

slide-39
SLIDE 39

Some common features

Large set of supported audio and video codecs I/O Alsa, portaudio, ao, etc.. File output HTTP, icecast, HLS, SRT, etc.. Harbor (icecast) input ffmpeg, gstreamer 39 / 73

slide-40
SLIDE 40

Some common features

Large set of supported audio and video codecs I/O Alsa, portaudio, ao, etc.. File output HTTP, icecast, HLS, SRT, etc.. Harbor (icecast) input ffmpeg, gstreamer Youtube, via RTMP & ffmpeg! 40 / 73

slide-41
SLIDE 41

Some common features

Large set of supported audio and video codecs I/O Alsa, portaudio, ao, etc.. File output HTTP, icecast, HLS, SRT, etc.. Harbor (icecast) input ffmpeg, gstreamer Youtube, via RTMP & ffmpeg! Functional cross-fading 41 / 73

slide-42
SLIDE 42

Some common features

Large set of supported audio and video codecs I/O Alsa, portaudio, ao, etc.. File output HTTP, icecast, HLS, SRT, etc.. Harbor (icecast) input ffmpeg, gstreamer Youtube, via RTMP & ffmpeg! Functional cross-fading blank detection 42 / 73

slide-43
SLIDE 43

Some common features

Large set of supported audio and video codecs I/O Alsa, portaudio, ao, etc.. File output HTTP, icecast, HLS, SRT, etc.. Harbor (icecast) input ffmpeg, gstreamer Youtube, via RTMP & ffmpeg! Functional cross-fading blank detection Ladspa, dssi, lilv & ffmpeg filters 43 / 73

slide-44
SLIDE 44

Usage

44 / 73

slide-45
SLIDE 45

Usage

Web radio 45 / 73

slide-46
SLIDE 46

Usage

Web radio With automated switch from playlist and live content 46 / 73

slide-47
SLIDE 47

Usage

Web radio With automated switch from playlist and live content and user interactions 47 / 73

slide-48
SLIDE 48

Usage

Web radio With automated switch from playlist and live content and user interactions Normalized audio volume across tracks 48 / 73

slide-49
SLIDE 49

Usage

Web radio With automated switch from playlist and live content and user interactions Normalized audio volume across tracks Also with compression, please! 49 / 73

slide-50
SLIDE 50

Usage

Web radio With automated switch from playlist and live content and user interactions Normalized audio volume across tracks Also with compression, please! Crossfade transitions 50 / 73

slide-51
SLIDE 51

Usage

Web radio With automated switch from playlist and live content and user interactions Normalized audio volume across tracks Also with compression, please! Crossfade transitions Jingle transitions 51 / 73

slide-52
SLIDE 52

Usage

Web radio With automated switch from playlist and live content and user interactions Normalized audio volume across tracks Also with compression, please! Crossfade transitions Jingle transitions Output in multiple format (mp3, aac, high/low quality) 52 / 73

slide-53
SLIDE 53

Usage

Web radio With automated switch from playlist and live content and user interactions Normalized audio volume across tracks Also with compression, please! Crossfade transitions Jingle transitions Output in multiple format (mp3, aac, high/low quality) To multiple destinations (icecast, HLS, etc..) 53 / 73

slide-54
SLIDE 54

Usage

Web radio With automated switch from playlist and live content and user interactions Normalized audio volume across tracks Also with compression, please! Crossfade transitions Jingle transitions Output in multiple format (mp3, aac, high/low quality) To multiple destinations (icecast, HLS, etc..) Not so easy after all! 54 / 73

slide-55
SLIDE 55

Usage

Web radio With automated switch from playlist and live content and user interactions Normalized audio volume across tracks Also with compression, please! Crossfade transitions Jingle transitions Output in multiple format (mp3, aac, high/low quality) To multiple destinations (icecast, HLS, etc..) Not so easy after all! Wait, how about video? 55 / 73

slide-56
SLIDE 56

Usage

Web radio With automated switch from playlist and live content and user interactions Normalized audio volume across tracks Also with compression, please! Crossfade transitions Jingle transitions Output in multiple format (mp3, aac, high/low quality) To multiple destinations (icecast, HLS, etc..) Not so easy after all! Wait, how about video? Sam : And midi? 😆 56 / 73

slide-57
SLIDE 57

Usage

# Configuration set("server.telnet", true) enable_replaygain_metadata() # Files-based sources files = playlist("~/radio/music.m3u") jingles = playlist("~/radio/jingles.m3u") files = random(weights=[1, 4], [jingles, files]) files = amplify(1.,override="replay_gain", files) # User requests user_requests = request.queue( id="user_requests") radio = fallback(track_sensitive=true, [user_requests, files]) # Crossfade tracks radio = crossfade(radio, smart=true) # Live source live = input.harbor("live")

57 / 73

slide-58
SLIDE 58

Usage

# Configuration set("server.telnet", true) enable_replaygain_metadata() # Files-based sources files = playlist("~/radio/music.m3u") jingles = playlist("~/radio/jingles.m3u") files = random(weights=[1, 4], [jingles, files]) files = amplify(1.,override="replay_gain", files) # User requests user_requests = request.queue( id="user_requests") radio = fallback(track_sensitive=true, [user_requests, files]) # Crossfade tracks radio = crossfade(radio, smart=true) # Live source live = input.harbor("live") # Full radio radio = fallback(track_sensitive=false, [live, radio]) radio = compress(radio) # Outputs formats = [ ("mp3-high", %mp3(bitrate=96)), ("mp3-low", %mp3(bitrate=128)), ("aac-high", %fdkaac(bitrate=64)), ("aac-low", %fdkaac(bitrate=32)), ]

  • utput.file.hls("/path/to/files",

hls_formats, radio) def mk_iceast_output(config) = let (name, format) = config

  • utput.icecast(format,

host = "localhost", port = 8000, password = "hackme", mount = name, radio) end list.iter(mk_icecast_output, formats)

58 / 73

slide-59
SLIDE 59

Usage (contd.)

Smart crossfade 59 / 73

slide-60
SLIDE 60

Usage (contd.)

Smart crossfade

def transition(a,b,ma,mb,sa,sb) if a <= medium and b <= medium and abs(a - b) <= margin then log("Transition: crossed, fade-in, fade-out.") add(fade.out(sa),fade.in(sb)) elsif # Do not fade if it's already very low. b >= a + margin and a <= medium and b <= high then log("Transition: crossed, no fade-out.") add(sa,sb) else log("No transition: just sequencing.") sequence([sa, sb]) end end radio = cross(transition, radio)

60 / 73

slide-61
SLIDE 61

Usage (contd.)

Clocks & latency control 61 / 73

slide-62
SLIDE 62

Usage (contd.)

Clocks & latency control Network glitches 62 / 73

slide-63
SLIDE 63

Usage (contd.)

Clocks & latency control Network glitches Clock inconsistency 63 / 73

slide-64
SLIDE 64

Usage (contd.)

Clocks & latency control Network glitches Clock inconsistency

input = input.alsa() clock.assign_new(id="icecast", [output.icecast(%mp3,mount="blah",mksafe(buffer(input)))])

  • utput.file(

%mp3,"record-%Y-%m-%d-%H-%M-%S.mp3", input)

64 / 73

slide-65
SLIDE 65

Usage (contd.)

Clocks & latency control Network glitches Clock inconsistency

input = input.alsa() clock.assign_new(id="icecast", [output.icecast(%mp3,mount="blah",mksafe(buffer(input)))])

  • utput.file(

%mp3,"record-%Y-%m-%d-%H-%M-%S.mp3", input)

Real-time vs. not real-time 65 / 73

slide-66
SLIDE 66

Usage (contd.)

Clocks & latency control Network glitches Clock inconsistency

input = input.alsa() clock.assign_new(id="icecast", [output.icecast(%mp3,mount="blah",mksafe(buffer(input)))])

  • utput.file(

%mp3,"record-%Y-%m-%d-%H-%M-%S.mp3", input)

Real-time vs. not real-time 66 / 73

slide-67
SLIDE 67

Future developments

67 / 73

slide-68
SLIDE 68

Future developments

Tight integration with ffmpeg 68 / 73

slide-69
SLIDE 69

Future developments

Tight integration with ffmpeg Extensive support for input and output encoding formats 69 / 73

slide-70
SLIDE 70

Future developments

Tight integration with ffmpeg Extensive support for input and output encoding formats Support for ffmpeg filters 70 / 73

slide-71
SLIDE 71

Future developments

Tight integration with ffmpeg Extensive support for input and output encoding formats Support for ffmpeg filters More support for video 71 / 73

slide-72
SLIDE 72

Future developments

Tight integration with ffmpeg Extensive support for input and output encoding formats Support for ffmpeg filters More support for video Support for encoded content 72 / 73

slide-73
SLIDE 73

Questions?

73 / 73