Skip to content

Instantly share code, notes, and snippets.

@huzhifeng
Created June 9, 2017 03:03
Show Gist options
  • Save huzhifeng/6c327b1d8be63920d27c604fe4497925 to your computer and use it in GitHub Desktop.
Save huzhifeng/6c327b1d8be63920d27c604fe4497925 to your computer and use it in GitHub Desktop.
Use ffmpeg to capture desktop
#!/bin/sh
VIDEO_DIR=${HOME}/Videos
VIDEO_TIME=`date +'%Y%m%d%H%M%S'`
VIDEO_SUFFIX=mkv
VIDEO_FILE=${VIDEO_DIR}/${VIDEO_TIME}.${VIDEO_SUFFIX}
if [ ! -e ${VIDEO_DIR} ]; then
mkdir -p ${VIDEO_DIR}
fi
DISPLAY_SIZE=`xdpyinfo | grep 'dimensions:' | awk '{print $2}'`
echo "Save to ${VIDEO_FILE}"
#ffmpeg -f alsa -ac 2 -i pulse -f x11grab -s $DISPLAY_SIZE -r 35 -qscale 1 -i :0.0 ${VIDEO_FILE}
ffmpeg -f alsa -ac 2 -i pulse -f x11grab -s $DISPLAY_SIZE -r 35 -qscale 1 -t 0:0:10 -i :0.0 ${VIDEO_FILE}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment