StuRa:Server/Streaming

Aus Wiki StuRa HTW Dresden
Version vom 25. März 2020, 11:58 Uhr von PaulRiegel (Diskussion | Beiträge) (→‎IceS2)
(Unterschied) ← Nächstältere Version | Aktuelle Version (Unterschied) | Nächstjüngere Version → (Unterschied)
Zur Navigation springen Zur Suche springen

potenzielle Software[Bearbeiten]

Software freebsd-port: wikipedia: Anmerkung
icecast
(freebsd-port:icecast)
freebsd-port:icecast2
wikipedia:de:Icecast
FFmpeg freebsd-port:ffmpeg wikipedia:de:FFmpeg
VLC
freebsd-port:vlc
freebsd-port:vls[1]
wikipedia:de:vlc
DarwinStreamingServer freebsd-port:DarwinStreamingServer wikipedia:Darwin Streaming Server in Anlehnung an Darwin, das Betriebssystem von Apple

ffserver[Bearbeiten]

How do I make it work?
      As a simple test, just run the following two command lines where
      INPUTFILE is some file which you can decode with ffmpeg:
              ffserver -f doc/ffserver.conf &
              ffmpeg -i INPUTFILE http://localhost:8090/feed1.ffm


howto[Bearbeiten]

Siehe auch

Betriebssystem[Bearbeiten]

auf die Schnelle

zur BuFaK WiSo 2015 HTW Dresden

LMDE 2

Für LMDE spricht, dass es durch seine Verwendung auf vielen Computern beim StuRa als am bekanntesten zu betrachten ist.

Anwendungen[Bearbeiten]

Icecast[Bearbeiten]

Icecast2[Bearbeiten]
Siehe auch
Installation Icecast2[Bearbeiten]
sudo apt-get install icecast2
Konfiguration Icecast2[Bearbeiten]

bearbeiteten (oder erstellen) der Datei für die Konfiguration von Icecast2

sudo $EDITOR /etc/icecast2/icecast.xml

prüfendendes anzeigen lassen der bearbeiteten Datei für die Konfiguration von Icecast2

sudo cat /etc/icecast2/icecast.xml
<icecast>
    <!-- Location and admin are two arbitrary strings that are e.g. visible
         on the server info page of the icecast web interface
         (server_version.xsl). -->
    <location>UK</location>
    <admin>webmaster@localhost</admin>

    <limits>
        <clients>100</clients>
        <sources>2</sources>
        <queue-size>524288</queue-size>
        <client-timeout>30</client-timeout>
        <header-timeout>15</header-timeout>
        <source-timeout>10</source-timeout>
        <!-- Same as burst-on-connect, but this allows for being more
             specific on how much to burst. Most people won't need to
             change from the default 64k. Applies to all mountpoints. -->
        <burst-size>65535</burst-size>
        <!--
        <max-bandwidth>100M</max-bandwidth>
        -->
    </limits>

    <authentication>
        <!-- Sources log in with username 'source' -->
        <source-password>hackme</source-password>
        <!-- Relays log in username 'relay' -->
        <relay-password>hackme</relay-password>

        <!-- Admin logs in with the username given below -->
        <admin-user>admin</admin-user>
        <admin-password>hackme</admin-password>
    </authentication>

    <!-- Uncomment this if you want directory listings -->
    <!--
    <directory>
        <yp-url-timeout>15</yp-url-timeout>
        <yp-url>http://dir.xiph.org/cgi-bin/yp-cgi</yp-url>
    </directory>
    -->

    <!-- This is the hostname other people will use to connect to your server.
    It affects mainly the urls generated by Icecast for playlists and yp
    listings. -->
    <hostname>localhost</hostname>

    <!-- Set the mountpoint for a shoutcast source to use, the default if not
         specified is /stream but you can change it here if an alternative is
         wanted or an extension is required
    <shoutcast-mount>/live.nsv</shoutcast-mount>
    -->

    <!-- port to use when talking to YP etc -->
    <!--<port>8000</port> -->

    <!-- You may have multiple <listener> elements -->
    <listen-socket>
        <port>8000</port>
        <!-- <bind-address>127.0.0.1</bind-address> -->
        <!-- use <shoutcast-mount> in here to implicitly define port n+1 -->
    </listen-socket>
    <!--
    <listen-socket>
        <port>8001</port>
        <ssl>1</ssl>
    </listen-socket>
    -->

    <!--<master-server>127.0.0.1</master-server>-->
    <!--<master-server-port>8001</master-server-port>-->
    <!--<master-update-interval>120</master-update-interval>-->

    <!--<master-username>hackme</master-username>-->
    <!--<master-password>hackme</master-password>-->

    <!-- issue above authentication for relays in slave setup -->
    <!--<master-relay-auth>1</master-relay-auth>-->

    <!-- setting this makes all relays on-demand unless overridden, this is
         useful for master relays which do not have <relay> definitions here.
         The default is 0 -->
    <!--<relays-on-demand>1</relays-on-demand>-->


    <!-- Request the master server to redirect new listeners to this slave
         the details passed are based on <hostname> and <port> -->
    <!--<master-redirect>1</master-redirect>-->

    <!-- The maximum nuber of slaves that can register for new listener redirection. -->
    <!--<max-redirect-slaves>10</max-redirect-slaves>-->

    <!-- Relays. State connection information, and by default 
         request inline metadata for mp3 streams if available.
         An on-demand relay will only retrieve the stream if
         there are listeners connected -->
    <!--
    <relay>
        <server>127.0.0.1</server>
        <port>8001</port>
        <mount>/example.ogg</mount>
        <local-mount>/different.ogg</local-mount>
        <on-demand>1</on-demand>
        <retry-delay>30</retry-delay>

        <relay-shoutcast-metadata>0</relay-shoutcast-metadata>
    </relay>
    -->
    <!-- Allow multiple master servers to be specified, tries each one in turn.
    <relay>
        <local-mount>/stream.mp3</local-mount>
        <server>a.b.c.d</server>
        <timeout>6</timeout>
        <master>
            <port>8000</port>
            <mount>/a</mount>
        </master>
        <master>
            <port>80</port>
            <mount>/</mount>
        </master>
    </relay>
    -->

    <!-- Only define a <mount> section if you want to use advanced options,
         like alternative usernames or passwords
         With a master/slave setup you need to define a mount in the master
         or else the server will assume that the stream is not to be made
         available to the slave.
    <mount>
        <mount-name>/*.ogg</mount-name>

        <username>othersource</username>
        <password>hackmemore</password>

        <max-listeners>1</max-listeners>
        <max-bandwidth>1000k</max-bandwidth>
        <file-seekable>0</file-seekable>
        <dump-file>/backup/live-%d-%b.ogg</dump-file>
        <burst-size>65536</burst-size>
        <fallback-mount>/example2.ogg</fallback-mount>
        <fallback-override>1</fallback-override>
        <fallback-when-full>1</fallback-when-full>
        <intro>/path/to/stream-intro.ogg</intro>
        <max-listener-duration>3600</max-listener-duration>
        <hidden>1</hidden>
        <authentication type="htpasswd">
                <option name="filename" value="myauth"/>
                <option name="allow_duplicate_users" value="0"/>
        </authentication>
        <on-connect>/home/icecast/bin/stream-start</on-connect>
        <on-disconnect>/home/icecast/bin/stream-stop</on-disconnect>
    </mount>
    -->
    <!-- other auth possibilities include running a command
         to do the auth, mount, user and pass are passed via
         stdin to the program
    <mount>
    ....
        <authentication type="command">
             <option name="listener_add" value="auth_verify"/>
        </authentication>
        
        or 

        for url auth, the add url needs to return a "icecast-auth-user:" http
        header for a user to authenicate. URLs are sent params via POST.

        <authentication type="url">
             <option name="username" value="admin"/>
             <option name="password" value="hackme"/>
             <option name="handlers"        value="3" />
             <option name="stream_auth"    value="http://myauthserver.com/scripts/auth_mount.php"/>
             <option name="mount_add"    value="http://myauthserver.com/scripts/add_mount.php"/>
             <option name="mount_remove" value="http://myauthserver.com/scripts/del_mount.php"/>
             <option name="listener_add"    value="http://myauthserver.com/scripts/add_listener.php"/>
             <option name="listener_remove" value="http://myauthserver.com/scripts/del_listener.php"/>
        </authentication>
    </mount>
    -->

    <fileserve>1</fileserve>

    <paths>
        <!-- basedir is only used if chroot is enabled -->
        <basedir>/usr/share/icecast2</basedir>

        <!-- Note that if <chroot> is turned on below, these paths must both
             be relative to the new root, not the original root -->
        <logdir>/var/log/icecast2</logdir>
        <webroot>/usr/share/icecast2/web</webroot>
        <adminroot>/usr/share/icecast2/admin</adminroot>
        <!-- <pidfile>/usr/share/icecast2/icecast.pid</pidfile> -->
        <!-- <ssl-certificate>/usr/share/icecast2/icecast.pem</ssl-certificate> -->
        <!-- <deny-ip>/path/to/file-with-IPs</deny-ip> -->
        <!-- <allow-ip>/path/to/file-with-IPs</allow-ip> -->
        <!-- <deny-agents>/path/to/file-with-useragents</deny-agents> -->

        <!-- location of mime types files used for file serving -->
        <!-- <mime-types>/etc/mime.types</mime-types> -->

        <!-- Aliases: treat requests for 'source' path as being for 'dest' path
             May be made specific to a port or bound address using the "port"
             and "bind-address" attributes.
          -->
        <!--
        <alias source="/foo" dest="/bar"/>
          -->
        <!-- Aliases: can also be used for simple redirections as well,
             this example will redirect all requests for http://server:port/ to
             the status page
          -->
        <alias source="/" dest="/index.html"/>
    </paths>

    <logging>
        <accesslog>access.log</accesslog>
        <errorlog>error.log</errorlog>
        <!-- <accesslog_ip>0<accesslog_ip> -->
        <!-- <playlistlog>playlist.log</playlistlog> -->
      	<loglevel>3</loglevel> <!-- 4 Debug, 3 Info, 2 Warn, 1 Error -->
      	<logsize>10000</logsize> <!-- Max size of a logfile -->
        <!-- If logarchive is enabled (1), then when logsize is reached
             the logfile will be moved to [error|access|playlist].log.DATESTAMP,
             otherwise it will be moved to [error|access|playlist].log.old.
             Default is non-archive mode (i.e. overwrite)
        -->
        <!-- <logarchive>1</logarchive> -->
    </logging>

    <security>
        <chroot>0</chroot>
        <!--
        <changeowner>
            <user>nobody</user>
            <group>nogroup</group>
        </changeowner>
        -->
    </security>
</icecast>

Neustarten vom Dienst Icecast2

sudo service icecast2 restart

Grundsätzlich ist der Einstieg zum Verweisen und Administrieren per http (bzw. https) möglich.

DarkIce[Bearbeiten]
Siehe auch
DarkIce konfigurieren[Bearbeiten]
(optional) beispielhafte Standarddatei /etc/darkice.cfg anschauen
cat /etc/darkice.cfg
# sample DarkIce configuration file, edit for your needs before using
# see the darkice.cfg man page for details

# this section describes general aspects of the live streaming session
[general]
duration        = 60        # duration of encoding, in seconds. 0 means forever
bufferSecs      = 5         # size of internal slip buffer, in seconds
reconnect       = yes       # reconnect to the server(s) if disconnected
realtime        = yes       # run the encoder with POSIX realtime priority
rtprio          = 3         # scheduling priority for the realtime threads

# this section describes the audio input that will be streamed
[input]
device          = /dev/dsp  # OSS DSP soundcard device for the audio input
sampleRate      = 22050     # sample rate in Hz. try 11025, 22050 or 44100
bitsPerSample   = 16        # bits per sample. try 16
channel         = 2         # channels. 1 = mono, 2 = stereo

# this section describes a streaming connection to an IceCast2 server
# there may be up to 8 of these sections, named [icecast2-0] ... [icecast2-7]
# these can be mixed with [icecast-x] and [shoutcast-x] sections
[icecast2-0]
bitrateMode     = abr       # average bit rate
format          = vorbis    # format of the stream: ogg vorbis
bitrate         = 96        # bitrate of the stream sent to the server
server          = yp.yourserver.com
                            # host name of the server
port            = 8000      # port of the IceCast2 server, usually 8000
password        = hackme    # source password to the IceCast2 server
mountPoint      = sample96  # mount point of this stream on the IceCast2 server
name            = DarkIce trial
                            # name of the stream
description     = This is only a trial
                            # description of the stream
url             = http://www.yourserver.com
                            # URL related to the stream
genre           = my own    # genre of the stream
public          = yes       # advertise this stream?
localDumpFile	= dump.ogg  # local dump file

# this section describes a streaming connection to an IceCast server
# there may be up to 8 of these sections, named [icecast-0] ... [icecast-7]
# these can be mixed with [icecast2-x] and [shoutcast-x] sections
[icecast-0]
bitrateMode     = cbr       # constant bit rate
bitrate         = 96        # bitrate of the mp3 stream sent to the server
quality         = 0.8       # encoding quality
server          = yp.yourserver.com
                            # host name of the server
port            = 8000      # port of the IceCast server, usually 8000
password        = hackme    # source password to the IceCast server
mountPoint      = sample96  # mount point of this stream on the IceCast server
name            = DarkIce trial
                            # name of the stream
description     = This is only a trial
                            # description of the stream
url             = http://www.yourserver.com
                            # URL related to the stream
genre           = my own    # genre of the stream
public          = yes       # advertise this stream?

# this section describes a streaming connection to a ShoutCast server
# there may be up to 8 of these sections, named [shoutcast-0] ... [shoutcast-7]
# these can be mixed with [icecast-x] and [icecast2-x] sections
[shoutcast-0]
bitrateMode     = vbr       # variable bit rate mode
quality         = 0.5       # encoding quality
server          = yp.yourserver.com
                            # host name of the server
port            = 8001      # source port of the ShoutCast server, usually 8001
password        = hackme    # source password to the ShoutCast server
name            = DarkIce trial
                            # name of the stream
url             = http://www.yourserver.com
                            # URL related to the stream
genre           = my own    # genre of the stream
public          = yes       # advertise this stream?
irc             = irc.yourserver.com
                            # IRC info related to the stream
aim             = aim here  # AIM info related to the stream
icq             = I see you too
                            # ICQ info related to the stream
darkice.cfg
beliebig zu benennende Datei in beliebigen Ordner

(optional) Erstellen eines Ordners für Ice*

Im Nachfolgenden wird davon ausgegangen, dass der Ordner mit diesem Name angelegt wurde. Alternativ wäre ~/.ice durch den entsprechenden Pfad zu ersetzen.
mkdir ~/.ice

Erstellen der Datei zur Konfiguration von DarkIce

nano ~/.ice/darkice.cfg

(optional) Anschauen der erstellten Datei zur Konfiguration von DarkIce

Wie nachfolgend dargestellt sollte die Datei natürlich nicht genau aussehen. Mindestens Zugangsdaten wie Passwörter sollte geändert sein. Die Darstellung dient nur zur Verdeutlichung wie die Datei grob aussehen soll.
cat ~/.ice/darkice.cfg
[general]
duration        = 0      # duration in s, 0 forever
bufferSecs      = 1      # buffer, in seconds
reconnect       = yes    # reconnect if disconnected

[input]
device          = default # or `pulse' for Pulseaudio
sampleRate      = 44100   # sample rate 11025, 22050 or 44100
bitsPerSample   = 16      # bits
channel         = 2       # 2 = stereo

[icecast2-0]
bitrateMode     = vbr       # variable bit rate (`cbr' constant, `abr' average)
quality         = 1.0       # 1.0 is best quality
format          = mp3       # format. Choose `vorbis' for OGG Vorbis
bitrate         = 256       # bitrate
server          = localhost # or IP
port            = 8000      # port for IceCast2 access
password        = hackme    # source password to the IceCast2 server
mountPoint      = mystream.mp3  # mount point on the IceCast2 server .mp3 or .ogg
name            = mystream
DarkIce starten[Bearbeiten]
darkice -c ~/.ice/darkice.cfg
DarkSnow[Bearbeiten]
Siehe auch
PulseAudio[Bearbeiten]
Siehe auch
pavucontrol &
paprefs &
pavumeter &
ls /etc/pulse

pulseaudio &
pulseaudio --check
pulseaudio -k
IceS2[Bearbeiten]

#IceS2 ist ein Projekt von #icecast.[2] Es kann eine Alternative zu #DarkIce sein.

alternative Anwendungen[Bearbeiten]

Einstellungen[Bearbeiten]

Einstellung vom Pegel des Signals[Bearbeiten]

  • von der Entstehung des Signals bis zur Übergabe in den Stream
Einstellung der Mikrofone

Die erste maßgebliche Grüße ist natürlich das Aufnehmen (Entstehen lassen) des Signals beim Mikrofon selbst.

Grundsätzlich kann unterschieden werden zwischen Aufnahme

  • des Raums
  • der Redenden

. Praktisch ist dazu die Empfindlichkeit einzustellen.

Im konkreten Beispiel wurden Mikrofone Sennheiser vom AVZ verwendet.

Für die Aufnahme des Raumes ist die Sensibilität des Mikrofons auf -&nsp;6&nsp;dB (oder gar 0&nsp;dB) einzustellen. Das Mikrofone ist so sensibel, dass jedes kleinste Geräusch im Raum als Signal aufgenommen wird. Das bedeutet jedoch auch, dass in unmittelbarer Nähe keine Geräusche erzeugt werden dürfen. Das direkte Sprechen in das Mikrofon kann so nicht genutzt werden. Auch darf sich das Mikrofon nicht in Nähe eines Lautsprechers befinden, dass das aufgenommene Signal direkt ausgibt, denn es kommt zur Rückkopplung.

Für die Aufnahme der Redenden ist die Sensibilität des Mikrofons auf -&nsp;42&nsp;dB (oder auch 36&nsp;dB) einzustellen.

Es sollte mit pavucontrol beim Reiter Eingabegeräte der Ausschlag kontrolliert werden.

Einstellung der Eingabe bei PulseAudio

Bei pavucontrol gibt es den Reiter Eingabegeräte. Dort sollten sich durch die Auswahl bei Anzeigen: All Input Devices alle nennenswerten Größen angezeigt werden lassen.

Monitor of Internes Audio Analog Stereo
100 %
Internes Audio Analog Stereo
10 % (oder gar (höchstens) 13 %)
Einstellung der Ausgabe für die Lautsprecher (über den Anschluss für Kopfhörer) bei PulseAudio
Einstellung der Ausgabe für den Stream (über beispielsweise #Darkice) bei PulseAudio

Bei pavucontrol gibt es den Reiter Aufnahme. Wenn eine Anwendung wie #Darkice läuft ist dort auch die Pegel und Möglichkeit zur Steuerung der verfügbar.

howto FreeBSD[Bearbeiten]

Das geht selbstverständlich auch alles mit BSD (FreeBSD/PC-BSD usw.). Das hätte beispielsweise den großen Vorteil einfach Jails als Virtualisierung nutzen zu können.

interessante Pakete (pkg):

  • icecast2
  • darkice
  • icegenerator

Sonstiges[Bearbeiten]

Mikrofonpegel beachten[Bearbeiten]

Mikrofon auf Lautsprecher[Bearbeiten]

Das kann auch der Ausgang für Kopfhörer sein.
Modul loopback mit PulseAudio erstellen[3]
pactl load-module module-loopback latency_msec=1
letzes gesetzes Modul loopback mit PulseAudio wieder entfernen
pactl unload-module $(pactl list short modules | awk '$2 =="module-loopback" { print $1 }' | tail -n 1)

aus einem Hörsaal[Bearbeiten]

Es gibt verschiedene Wege.

Wie gewohnt, kann WLAN verwendet werden. Bei der Bereitstellung von Streaming sollte wohl aber die "festest" mögliche Anbindung genutzt werden, wobei eigentlich LAN zu bevorzugen wäre. Bei WLAN an unserer Hochschule sollte eduroam verwendet werden. VPN/WEB fällt natürlich schon allein wegen der Begrenzung zur Notwendigkeit der erneuten Anmeldung nach einer bestimmten Dauer heraus.

Wenn LAN genutzt werden kann, was zu bevorzugen ist, muss wohl in den Hörsälen das sogenannte Hörsaalnetz genutzt. Um eine Verbindung zu allen anderen Rechner und dem Internet herstellen zu können, muss VPN für das Hörsaalnetz verwendet werden.

VPN für das Hörsaalnetz verwenden[Bearbeiten]
eigentlich siehe VPN
Installieren von vpnc
sudo apt-get install vpnc
sudo apt-get install network-manager-vpnc

http://www.rz.htw-dresden.de/vpn/vpnsoft/profile/HTW_Hoersaalnetz.pcf

Datei zur Konfiguration von VPN pcf zu einer Datei zur Konfiguration (einer anderen Art) von VPN machen
sudo pcf2vpnc ./HTW_Hoersaalnetz.pcf ./HTW_Hoersaalnetz.conf
Zugangsdaten in die Datei zur Konfiguration eintragen
sudo nano ./HTW_Hoersaalnetz.conf
Aufzeichnung erstellen[Bearbeiten]
gnome-media
#DarkIce
  • config

[icecast2-0]

remoteDumpFile = name-einer-datei localDumpFile = name-einer-datei


(notfalls wohl auch) ardour
sudo apt-get install ardour

Aufzeichnung schneiden[Bearbeiten]

Installieren von mp3splt
sudo apt-get install mp3splt
Installieren von "plugins" für andere Formate
sudo apt-get install libmp3splt0-ogg libmp3splt0-flac
Schneiden
Der erste Zeitpunkt mm.ss ist der Beginn. Der zweite Zeitpunkt mm.ss ist das Ende. file ist der Name der Datei im aktuellen Verzeichnis.
mp3splt mm.ss mm.ss file
zur Bedienung mit der grafischen Oberfläche
sudo apt-get install mp3splt-gtk

Siehe auch[Bearbeiten]