Skip to content

Instantly share code, notes, and snippets.

@sepastian
Last active November 2, 2022 11:25
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 sepastian/613b1eedee0a5ba4f2e853b8da6851d3 to your computer and use it in GitHub Desktop.
Save sepastian/613b1eedee0a5ba4f2e853b8da6851d3 to your computer and use it in GitHub Desktop.
Record left monitor from CLI
# Oh-My-ZSH custom function to record left monitor from CLI.
#
# Place in $ZSH/.oh-my-zsh/custom.
#
# Two monitors at screen 0, the left one connected at DP-1:
#
# xrandr
# Screen 0: minimum 320 x 200, current 3840 x 1200, maximum 16384 x 16384
# DP-1 connected primary 1920x1200+1920+0 (normal left inverted right x axis y axis) 518mm x 324mm
# 1920x1200 59.95*+
#
# You may have to adjust "-s 1920x1200", depending on your setup.
record_left_monitor() {
o=/tmp/screen_recording_$(date +"%Y%m%dH%H%M%S").mp4
echo "Recording to ${o}."
echo "Press CTRL+c to quit."
ffmpeg \
-f x11grab \
-s 1920x1200 \
-r 25 \
-i :0.0 \
-qscale 0 \
"${o}"
echo "Wrote ${o}, bye."
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment