#!/bin/sh
#
# vlc_stream_cam.sh
# 2012-09-28
# by Gernot WALZL
#
# Uses VideoLAN (vlc) to stream the webcam over http.
#
# http://wiki.videolan.org/Documentation:Modules/v4l2
# http://www.videolan.org/doc/streaming-howto/en/ch03.html
# http://www.videolan.org/streaming-features.html
# http://wiki.videolan.org/Codec
#
# http://taper.alienbase.nl/mirrors/people/alien/restricted_slackbuilds/vlc/

VIDEODEV=${VIDEODEV:-/dev/video0}
AUDIODEV=${AUDIODEV:-/dev/audio}
PORT=${PORT:-1234}

vlc v4l2://$VIDEODEV:width=320:height=240:fps=5 :input-slave=oss://$AUDIODEV \
  --sout "#transcode{vcodec=h264,vb=256,acodec=mp4a,ab=32,channels=1}:standard{access=http,mux=ts,dst=:$PORT}" \
  -I dummy