Audio-Streaming

März 3, 2013·
Julio Batista Silva
Julio Batista Silva
· 2 Min Lesezeit

PulseAudio

Weg 1 – Umgebungsvariable PULSE_SERVER

  • Server (Rechner, auf dem der Ton ausgegeben wird, z. B. 10.0.0.3)

    1. paprefs installieren:

      sudo pacman -S paprefs
      
    2. In paprefs unter Network Server aktivieren:

      • Enable network access to local sound devices
      • Allow other machines on the LAN to discover local sound devices
      • Don’t require authentication
  • Client (Rechner mit den Audiodateien, z. B. 10.0.0.2)

    Umgebungsvariable setzen und abspielen:

    export PULSE_SERVER=10.0.0.1
    mplayer musica.flac
    

Weg 2 – MPD

PulseAudio‑Netzwerkzugriff erlauben:

pactl load-module module-native-protocol-tcp auth-anonymous=1

Oder sicherer per ACL:

pactl load-module module-native-protocol-tcp auth-ip-acl="127.0.0.1;10.0.0.2"

Output in ~/.mpd/mpd.conf ergänzen:

audio_output {
    type    "pulse"
    name    "Acer - Pulseaudio"
    server  "10.0.0.1"
    #sink   "remote_server_sink"
}

Im ncmpcpp (Menü 8) ein‑/ausschalten.

RTP

PulseAudio streamt via RTP als Multicast – kann das WLAN belasten.

pactl load-module module-rtp-recv

MPD per Android steuern

MPDroid

MPD Streaming

quality ist VBR, bitrate ist CBR.

MPD HTTP Streaming

In ~/.config/mpd.conf:

audio_output {
    type                "httpd"
    name                "My HTTP Stream"
    encoder             "vorbis"                # optional, vorbis or lame
    port                "8000"
    bind_to_address     "0.0.0.0"               # optional, IPv4 or IPv6
    bitrate             "128"                   # do not define if quality is defined
    format              "44100:16:1"
    max_clients "0"                     # optional 0=no limit
}

Im Browser oder Player http://10.0.0.2:8000 öffnen und abspielen.

MPD FIFO + netcat + VLC

In ~/.config/mpd.conf:

audio_output {
    type            "fifo"
    name            "FIFO2"
    path            "/tmp/mpd.fifo"
    format          "44100:16:2"
}

Server:

nc -u 10.0.0.2 8765 < /tmp/mpd.fifo

Client:

nc -u -l 8765 | ~/Applications/VLC.app/Contents/MacOS/VLC --demux=rawaud --rawaud-channels 2 --rawaud-samplerate 44100 --audio-desync=250 -

Julio Batista Silva
Autoren
Senior Cloud-Entwickler
comments powered by Disqus