Script desktop grab.sh
Jump to navigation
Jump to search
#!/bin/bash
#
# NAME desktop_grab.sh
# VERSION 0.1
# REQUIRED avconv, pacmd, xrandr
#
echo "Grab desktop current video with microphone audio and speaker output";
####
# Check
####
if test -z "$1"; then
echo
echo "Usage: $0 [-t] <file_output.avi>"
echo
exit -1;
else
OUT_FILE="$1";
fi;
####
# Detect devices
####
AUDIO_OUT=`pacmd list-sources | sed -n 's/.*name: <\(.*.monitor\)>.*/\1/p'`;
VIDEO_RES=`xrandr --current | sed -n 's/.* connected \([0-9]*\)x\([0-9]*\)+.*/\1x\2/p'`;
####
# Run
####
avconv -f pulse -i default -f pulse -i ${AUDIO_OUT} -f x11grab -s ${VIDEO_RES} -i :0.0 -filter_complex amix -acodec libmp3lame -vcodec libx264 -preset ultrafast ${OUT_FILE};
####
# Print result file
####
ls --color -hl "${OUT_FILE}";
# End