Last active
August 29, 2015 14:06
-
-
Save boltronics/56006fc6b438a10ac1a7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
declare -r vout_dir="${0%/*}" | |
declare -r time_stamp="$(date +'%Y%m%d%H%M%S')" | |
declare -r file_name="recording-${time_stamp}" | |
declare -i capture_x_offset=0 | |
# Check if both monitors are active | |
if [ "$(xrandr | head -n 1 | sed 's/.*current\ \([0-9]*\)\ .*/\1/')" = "3840" ] | |
then | |
# Only capture the right monitor | |
capture_x_offset=1920 | |
fi | |
if which avconv >/dev/null | |
then | |
# http://wiki.oz9aec.net/index.php/High_quality_screen_capture_with_avconv | |
avconv -f alsa -ac 2 -ar 44100 -i pulse -f x11grab -r 25 -s 1920x1080 \ | |
-i :0.0+${capture_x_offset},0 -acodec libvorbis -vcodec libx264 \ | |
-pre:0 lossless_ultrafast -threads auto "${file_name}.mkv" | |
elif which ffmpeg >/dev/null | |
then | |
# http://wiki.oz9aec.net/index.php/High_quality_screen_capture_with_Ffmpeg | |
ffmpeg -f alsa -i pulse -f x11grab -r 25 -s 1920x1080 \ | |
-i :0.0+${capture_x_offset},0 -acodec pcm_s16le -vcodec libx264 \ | |
-vpre lossless_ultrafast -threads 0 "${file_name}.mkv" | |
elif which recordmydesktop > /dev/null | |
then | |
recordmydesktop -x 0 -y 0 --width 1920 --height 1080 --full-shots \ | |
--channels 2 --freq 44100 --device pulse \ | |
--on-the-fly-encoding --s_quality 10 --no-frame -o "${file_name}.ogv" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment