You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
208 lines
6.2 KiB
208 lines
6.2 KiB
% |
|
% new 24 juillet 2014 - Mixart Myrys |
|
% |
|
\chapter{streaming} |
|
\label{chap:streaming} |
|
\index{streaming} |
|
|
|
Avertissement : pour le moment\footnote{En juillet 2014}, nous |
|
n'allons nous pencher que sur la diffusion de flux audios, avec |
|
des encodages libres comme \textsl{ogg} ou \textsl{speex}. |
|
|
|
Tout simplement parce que le monde de la vidéo est un gigantesque |
|
foutoir de codecs, de containers, de brevets logiciels et |
|
d'incompatiblités diverses et variées. |
|
|
|
|
|
%------------------------------------------------------------- |
|
\section{icecast2} |
|
\index{icecast2} |
|
\label{icecast2} |
|
|
|
\begin{quote} |
|
Icecast, the project, is a collection of programs and libraries for |
|
streaming audio over the Internet. This includes: |
|
Icecast, the program that streams audio data to listeners, |
|
libshout, a library for communicating with Icecast servers and |
|
IceS\index{ices}, a program that sends audio data to Icecast servers |
|
|
|
\end{quote} |
|
|
|
Icecast est, semble-t-il, \textbf{le} serveur de stream de référence. |
|
Il se configure facilement avec des fichiers en XML\index{XML}. |
|
Première approche d'une ergonomie différente, vous êtes avertis. |
|
|
|
\textsl{more to come...} |
|
|
|
%------------------------------------------------------------- |
|
\section{idjc} |
|
\index{idjc} |
|
|
|
\begin{quote} |
|
Internet DJ Console is an Internet radio application for making a |
|
live radio show or podcast. Features include two main media players |
|
with a crossfader, a jingle player, microphone signal processing |
|
(compressor and noise gate) |
|
\end{quote} |
|
|
|
%------------------------------------------------------------- |
|
\section{liquidsoap} |
|
\index{liquidsoap} |
|
|
|
\texttt{https://www.liquidsoap.info/} |
|
|
|
\begin{quote} |
|
Liquidsoap is an extensible and flexible audio stream generator, mainly |
|
used for streaming to a shoutcast/icecast server. |
|
It is also possible |
|
to output in a file, to speakers or as raw PCM stream. |
|
liquidsoap can |
|
perform any audio processing, mixing streams together, |
|
applying filters, generating sound procedurally, |
|
there is no limit but your imagination. |
|
Input files can be accessed through the network, using samba, |
|
ftp or speech synthesis. |
|
The system features lots of programming operators, including user |
|
requests, time-based selection, sum... |
|
\end{quote} |
|
|
|
Un étonnant langage de script pour gérer tous ces octets musicaux |
|
en les promenant un peu dans tous les sens, la possibilité |
|
de commander Savonet avec un simple telnet\index{telnet}. |
|
Vite, un exemple d'utilisation, vous créez un fichier texte avec |
|
cez quelques lignes dedans et vous le sauvez sous le nom |
|
\texttt{savon.liq} : |
|
|
|
\begin{verbatim} |
|
set("log.file.path","/tmp/savon.log") |
|
set("log.stdout",true) |
|
|
|
output.icecast (%vorbis, |
|
host = "10.20.0.23", |
|
port = 1984, |
|
password = "hopla!", |
|
mount = "savon.ogg", |
|
single("loveme.ogg")) |
|
\end{verbatim} |
|
|
|
Avec ce petit programme, nous pouvons envoyer en boucle un fichier |
|
Ogg vers notre serveur. |
|
Les deux premières lignes permettent de voir et d'enregistrer les |
|
diverses actions. |
|
Et la grosse instruction \texttt{output.icecast} |
|
envoie la musique dans votre serveur |
|
Icecast2 en passant les paramètres nécessaires. |
|
|
|
\subsection{10.20.0.23} |
|
|
|
|
|
Maintenant, voyons un exemple plus complet et plus réaliste, |
|
largement inspiré d'un tutoriel de la documentation officielle, |
|
et qui deviendra un de ces jours la base de Radio-Myrys : |
|
|
|
\begin{verbatim} |
|
set("log.file.path", "/tmp/savon.log") |
|
set("log.stdout", false) |
|
|
|
default = single("loveme.ogg") |
|
|
|
openbsd = playlist(mode="random", "files/openbsd.pls") |
|
others = playlist(mode="random", "files/others.pls") |
|
jingles = playlist( "files/jingles.pls") |
|
|
|
radio = fallback([ switch([({ 5h-11h }, openbsd), |
|
({ 11h-5h }, others)]), |
|
default]) |
|
|
|
radio = random(weights=[1,12],[ jingles, radio ]) |
|
|
|
output.icecast( %vorbis, |
|
host = "localhost", |
|
port = 1984, |
|
password = "hopla!", |
|
mount = "savon.ogg", |
|
radio) |
|
\end{verbatim} |
|
|
|
Ah bah oui, ça commence à être robuste, mais en fait c'est |
|
assez simple à comprendre, et un peu plus compliqué à mettre |
|
en œuvre. |
|
|
|
|
|
|
|
On se retrouve vite face à un problème classique : |
|
les différences de niveau sonore entre les divers morceaux. |
|
Et comme on veut avancer sur d'autres choses, on rache un |
|
petit bout de Bash avec de la poudre verte dedans : |
|
|
|
\begin{verbatim} |
|
#!/bin/bash/ |
|
echo "que faire ?" |
|
\end{verbatim} |
|
|
|
Cette poudre verte pourrait bien être \texttt{vorbisgain(1)}\dots |
|
|
|
\subsection{rotation des playlists} |
|
|
|
\begin{verbatim} |
|
pl2014 = playlist("2014") |
|
pl2013 = playlist("2013") |
|
... |
|
jingles = playlist("jingles") |
|
s = rotate([pl2014, pl2013, ..., jingles]) |
|
output.icecast(..., s) |
|
\end{verbatim} |
|
|
|
|
|
\subsection{trucs divers} |
|
|
|
Que signifie ce message : \textbf{That source is fallible.} ? |
|
Par exemple, que le fichier que vous aviez soigneusement |
|
désigné comme \texttt{default} n'existe plus sur le disque. |
|
|
|
|
|
Comment envoyer vers plusieurs icecasts ? Bah c'est très facile : |
|
il suffit de mettre plusieurs "blocs" \texttt{output.icecast} à |
|
la suite les uns des autres ;) |
|
|
|
|
|
%==================================================================== |
|
\section{Source clients} |
|
\label{sourceclients} |
|
|
|
%------------------------------------------------------------- |
|
|
|
\subsection{Ezstream} |
|
|
|
\begin{quote} |
|
Ezstream is an audio and video streaming client which feeds any |
|
icecast server with audio data and metadata from a standard input |
|
without reencoding. It thus requires very little CPU resources. Some |
|
playlists can be looped and composed with MP3, Ogg Vorbis or Ogg |
|
Theora media files. |
|
\end{quote} |
|
|
|
%------------------------------------------------------------- |
|
|
|
\subsection{darkice} |
|
\index{darkice} |
|
|
|
\begin{quote} |
|
DarkIce as a live audio streamer. It records audio from an audio |
|
interface (e.g. sound card), encodes it and sends it to a streaming server. |
|
\end{quote} |
|
%------------------------------------------------------------- |
|
\subsection{VLC} |
|
\index{vlc} |
|
|
|
|
|
%==================================================================== |
|
\section{libshout}\index{libshout}\label{libshout} |
|
|
|
Mais c'est quoi ?\index{XXX} |
|
|
|
|
|
%==================================================================== |
|
|
|
%------------------------------------------------------------- |
|
|
|
|