Skip to content

Instantly share code, notes, and snippets.

@ueno
Created November 25, 2009 03:33
Show Gist options
  • Save ueno/242449 to your computer and use it in GitHub Desktop.
Save ueno/242449 to your computer and use it in GitHub Desktop.
#!/bin/sh
# Capture video/audio stream and send it to an Icecast2 server on
# http://127.0.0.1:8000 and to a local file sink "stream.ogv".
# Only tested with Logitech Qcam Pro 9000.
: ${VDEV:=/dev/video1}
: ${OV_TEXT:="caption"}
: ${OV_FONT:="VL Gothic 18"}
: ${ADEV:=hw:1,0}
m4 <<EOF | xargs gst-launch-0.10
dnl
dnl encode video stream and name it "venc"
dnl
v4l2src queue-size=16 device="$VDEV" ! queue
! videoscale ! video/x-raw-yuv,width=320,height=240
! textoverlay valign=bottom halign=right text="$OV_TEXT" font-desc="$OV_FONT"
! theoraenc quality=60 name=venc
dnl
dnl encode audio stream and name it "aenc"
dnl
alsasrc device="$ADEV" ! audio/x-raw-int,rate=16000,channels=1,depth=16
! audioconvert ! queue2 max-size-buffers=10000 max-size-bytes=0 max-size-time=0
! vorbisenc quality=0.9 name=aenc
dnl
dnl merge venc and aenc
dnl
oggmux name=mux
venc. ! mux.
aenc. ! mux.
dnl
dnl create a tee and send the result to a local file
dnl
mux. ! queue ! tee name=t ! queue ! filesink location=stream.ogv
dnl
dnl send the result to an Icecast2 server
dnl
t. ! queue ! shout2send ip=127.0.0.1 port=8000 password=hackme mount=/stream.ogv
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment