August 07, 2014

Capture/Record webcam, desktop and audio under Ubuntu 14.04

Bash script:

fname=`date +"%d.%m.%Y_%H:%M:%S_%P"`.'_screencast.mp4'
vlc --qt-minimal-view v4l2:///dev/video0 &
vlc --qt-minimal-view screen:// :screen-fps=20 :screen-follow-mouse :live-caching=300 :input-slave=alsa://hw:0,0 :sout="#transcode{vcodec=h264,vb=384,fps=5,acodec=mpga}:duplicate{dst=std{mux=mp4,access=file,dst='$fname'}}" &

These set of commands start two instances of VLC.
The first command fires up a minimal view of VLC with video source "/dev/video0" (the default location of webcamera in most general cases).

The second command starts another minimal VLC instance with video from screen:// (desktop) and audio from default built-in microphone "hw:0,0". Output is encoded and saved in current directory as an mp4 file.

Recording stops when you close VLC instances.

1 comment:

  1. great script but 2 things bug me,
    1. how to resize the vlc webcam output to like 400x400 pixel (do know about --sout-transcode-maxwidth=integer but how to put it ) along with putting it aside in a corner(say bottom right).
    2. how to keep the vlc webcam output on top of screen.