[vlc] script to start multiroom audio(netsync)

Ryan Nowakowski tubaman at fattuba.com
Thu Dec 6 08:59:35 CET 2007


Here's a bash script to launch vlc in multi-room fashion.  I have 3 linux
hosts in different rooms and it's nice to be able to play synchronized
music throughout the house.  It requires password-less ssh access to the
clients.


#!/bin/bash

MULTICAST_IP=239.255.100.100

# we assume one of the clients is the host running this script
CLIENTS="$HOSTNAME host2 host3"

# the web server interface port
SWEBPORT=8887

# we assume the netsync master client is the host running this script
MASTER=$HOSTNAME

# we'll setup an sap announcment using the name of the host running this script
SAPNAME=$HOSTNAME

# start the clients
for client in $CLIENTS; do
  ssh $client killall vlc
  if [ "$client" == "$MASTER" ]; then
    echo we are the master
    NETSYNC="--control netsync --netsync-master"
  else
    echo we sync with the master
    NETSYNC="--control netsync --netsync-master-ip $MASTER"
  fi
  ssh $client vlc --intf dummy udp://@$MULTICAST_IP $NETSYNC &
done

# after the clients are running, start the server as a vlc window and wait
vlc --intf wx --extraintf http --http-host *:$SWEBPORT "$@" --sout "#standard{access=udp,mux=ts,dst=$MULTICAST_IP,sap,name=\"$SAPNAME\"}" --ttl 1

# after the server dies, presumably because we closed the vlc window,
# kill the clients
for client in $CLIENTS; do
  ssh $client killall vlc
done



More information about the vlc mailing list