Skip to content

Instantly share code, notes, and snippets.

@ecthiender
Last active November 9, 2020 07:36
Show Gist options
  • Save ecthiender/0b9626fdc8826d5b88204cfadb4f2947 to your computer and use it in GitHub Desktop.
Save ecthiender/0b9626fdc8826d5b88204cfadb4f2947 to your computer and use it in GitHub Desktop.
Linux & ffmpeg: One-liner to record your screen along with audio
#!/bin/bash
set -e
resolution="$1"
if [[ -z "$resolution" ]]; then
resolution="1366x768"
echo "[WARN] No resolution passed. Defaulting to $resolution."
fi
outfile="$2"
if [[ -z "$outfile" ]]; then
outfile="output-$(date +%s).mkv"
fi
# The input devices might need to changed depending on your setup
ffmpeg -f x11grab -s $resolution -i :0.0 -f alsa -i default $outfile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment