#!/bin/sh
# http://www.videolan.org/doc/streaming-howto/en/ch03.html
# About ACL
# access=
# Item options are: user=<user name> to enable HTTP basic authentication and set the user, pwd=<password> to set the basic authentication password, mime=<mime type> to set the mime type returned by the server.

# web admin interface user/passwd is in /usr/share/vlc/http/admin/.access

source="@IP:PORT"
target="LOCAL_IP:LOCALPORT"
HTTP_USER="USERNAME"
HTTP_PWD="PASSWORD"
bitsrate=512
#scale="0.75"
scale="1"
export DISPLAY=localhost:1
export LC_ALL=C
#vlc udp://$source --sout "#transcode{vcodec=mp4v,vb=512,scale=1,acodec=mpga,ab=96,channels=2}:duplicate{dst=std{access=http,mux=ts,url=$target}}"

# relay broadcast
#vlc -vvv -I http --http-host=:8033 udp://$source --sout "#transcode{vcodec=mp4v,vb=512,scale=1,acodec=mpga,ab=96,channels=2}:duplicate{dst=std{access=http{user=$HTTP_USER,pwd=$HTTP_PWD},mux=ts,url=$target}}"
vlc -v udp://$source --sout "#transcode{vcodec=mp4v,vb=$bitsrate,scale=$scale,acodec=mpga,ab=96,channels=2}:duplicate{dst=std{access=http{user=$HTTP_USER,pwd=$HTTP_PWD},mux=ts,url=$target}}"

# capture screen and broadcast
# vlc screen:// --sout "#transcode{vcodec=mp4v,vb=512,scale=1,acodec=mpga,ab=96,channels=2}:duplicate{dst=std{access=http{user=$HTTP_USER,pwd=$HTTP_PWD},mux=ts,url=$target}}"

