#!/bin/bash # Record an MPEG video from my webcam or screen and audio from my soundcard if [ "$1" = "-screen" ]; then audio="hw:0,0" outfile="${2:-screen.mpg}" cvlc --no-sout-display-audio "screen://" ":screen-fps=8" ":screen-width=640" ":screen-height=480" \ ":screen-caching=1000" ":screen-mouse-image=/usr/share/qt4/doc/html/images/cursor-arrow.png" \ ":input-slave=alsa://$audio" ":v4l2-standard=0" ":sout=#transcode{vcodec=mp2v,vb=8000,scale=1,\ acodec=mpga,ab=128,channels=2,samplerate=44100}:std{access=file,mux=ts,dst=$outfile}" & ( while sleep 1; do du -k "$outfile" | tr '\n' '\r'; done; ); echo "Killing VLC."; kill -INT $? else video="/dev/video1" audio="hw:0,0" outfile="${1:-webcam.mpg}" vlc --no-sout-display-audio "v4l2://$video" ":input-slave=alsa://$audio" ":v4l2-standard=0" \ ":sout=#transcode{vcodec=mp2v,vb=8000,scale=1,acodec=mpga,ab=128,channels=2,samplerate=44100}:\ duplicate{dst=std{access=file,mux=ts,dst=$outfile},dst=display}" fi