Created
September 8, 2014 16:18
-
-
Save sfan5/8b80bf332ab9066eb3e2 to your computer and use it in GitHub Desktop.
Records a window
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 -e | |
CRF=21 | |
ABITRATE=256k | |
FILENAME=recording`date +%d-%m-%Y_%H.%M`.mp4 | |
CMD=`xwininfo | awk '/Width/{printf"ffmpeg -f x11grab -s "$2"x"}/Height/{printf$2" -i '$DISPLAY'"}/Corners/{gsub(/\+/,",",$2);sub(/,/,"+",$2);print$2" -f alsa -i pulse -c:v libx264 -preset ultrafast -crf 0 -c:a copy"}'` | |
CMD="${CMD} -vf scale='iw+mod(iw,2):ih+mod(ih,2)' _tmp_record.nut" | |
# -vf scale='iw+mod(iw,2):ih+mod(ih,2)' makes sure the width and height are diviseable by 2 (needed for libx264) | |
echo "Press ^C to stop recording" | |
$CMD || true | |
ffmpeg -i _tmp_record.nut -c:v libx264 -pix_fmt yuv420p -crf $CRF -tune film -c:a libfdk_aac -b:a $ABITRATE -movflags +faststart "$FILENAME" | |
rm -f _tmp_record.nut |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment