Skip to content

Instantly share code, notes, and snippets.

@vi
Created September 5, 2011 07:00
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vi/1194277 to your computer and use it in GitHub Desktop.
Save vi/1194277 to your computer and use it in GitHub Desktop.
Ad-hoc HTTP video streamer from webcam using socat and ffmpeg
#!/bin/sh
schedtool -R -p 2 -e /usr/bin/socat tcp-l:5555,fork,reuseaddr system:'printf "HTTP/1.0\\\\x20200\\\\x20OK\\\\r\\\\nContent-Type\:\\\\x20video/x-matroska\\\\r\\\\n\\\\r\\\\n" && ffmpeg -f video4linux2 -ss 2 -i /dev/video0 -ss 2 -f oss -ac 1 -i /dev/dsp -s 320x240 -vcodec libx264 -vpre ultrafast -b 300k -ar 22050 -acodec libmp3lame -ab 32k -f matroska pipe\:1 < /dev/null'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment