Skip to content

Instantly share code, notes, and snippets.

@oskar456
Last active August 3, 2018 08:38
Show Gist options
  • Save oskar456/e887539e66af8cd045f1180f1969fab3 to your computer and use it in GitHub Desktop.
Save oskar456/e887539e66af8cd045f1180f1969fab3 to your computer and use it in GitHub Desktop.
FFmpeg record my desktop
#!/bin/sh
SCREEN_SIZE="1920x1080"
ORIGIN="0,0"
# For dual screen setup where projected is on the right side of the desktop:
#ORIGIN="1920,0"
ffmpeg -vaapi_device /dev/dri/renderD128 -framerate 25 -video_size $SCREEN_SIZE \
-f x11grab -i :0+$ORIGIN -f pulse -ac 2 -i default -vf 'format=nv12,hwupload' \
-c:v h264_vaapi -c:a aac screencast-$(date +%H%M%S).mkv
## Variant without HW accelerated encoding
#ffmpeg -framerate 25 -video_size $SCREEN_SIZE \
# -f x11grab -i :0+$ORIGIN -f pulse -ac 2 -i default \
# -c:v libx264 -c:a aac screencast-$(date +%H%M%S).mkv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment