Skip to content

Instantly share code, notes, and snippets.

@hhyyrylainen
Created October 11, 2015 07:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hhyyrylainen/30a025d8f6055266bfa4 to your computer and use it in GitHub Desktop.
Save hhyyrylainen/30a025d8f6055266bfa4 to your computer and use it in GitHub Desktop.
#!/bin/sh
ffmpeg -framerate 25 -video_size 1920x1080 -f x11grab -i :0.0+1920,0 -f alsa -ac 2 -i pulse -vcodec libx264 -crf 0 -preset ultrafast -strict -2 screenrecord.mp4
echo "Re-encoding to use less space"
# Find a file name that doesn't exist yet
fileending=""
if [ -f screenrecord_encoded_$fileending.mp4 ]
then
fileending="2"
while [ -f screenrecord_encoded_$fileending.mp4 ]
do
fileending=$((fileending + 1))
done
fi
echo "Encoding final file screenrecord_encoded_$fileending.mp4"
ffmpeg -i screenrecord.mp4 -strict -2 screenrecord_encoded_$fileending.mp4
echo "Deleting raw file"
rm screenrecord.mp4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment