Skip to content

Instantly share code, notes, and snippets.

@TheNeikos
Created April 9, 2017 20:43
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 TheNeikos/7ee89bff513c1a4931b8178b47503e4c to your computer and use it in GitHub Desktop.
Save TheNeikos/7ee89bff513c1a4931b8178b47503e4c to your computer and use it in GitHub Desktop.
A simple way to create videos of your screen on linux!
# Screen Video Capture
#! /usr/bin/env sh
length=${1-3}
delay=${2-0}
geometry=($(xrectsel "%wx%h %x,%y"))
output_dir="$(xdg-user-dir VIDEOS)/captures"
mkdir -p "$output_dir"
sleep $delay
ffmpeg -t "$length" -video_size "${geometry[0]}" \
-f x11grab -i ":0.0+${geometry[1]}" \
-c:v libx264 -preset ultrafast \
-pix_fmt yuv420p \
-vf "scale=448:-2:flags=lanczos+full_chroma_inp+full_chroma_int+accurate_rnd" \
-flags +global_header -movflags faststart \
"$output_dir/$(date +"%y_%d_%m_%H_%M_%S").mp4"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment