aboutsummaryrefslogtreecommitdiff
path: root/screencaster
blob: 72b766f14d0dee1d01e74279dcfb9c1d619f0199 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/env bash
#
# Screencast recorder
#
# See https://links.fluxo.info/bookmarks/rhatto/screencast
#     https://askubuntu.com/questions/4428/how-can-i-record-my-screen
#     https://github.com/dilawar/Scripts/blob/master/record_my_desktop.sh
#     https://trac.ffmpeg.org/wiki/Capture/Desktop
#     https://andreafortuna.org/2019/09/20/how-to-record-screen-on-linux-from-command-line/
#     https://superuser.com/questions/510985/how-can-i-crop-a-video-to-a-part-of-the-view
#

# Parameters
BASENAME="`basename $0`"
OUT="$1"

# Syntax check
if [ -z "$OUT" ]; then
  echo "usage: $BASENAME <outfile>"
  echo "example: $BASENAME out.mkv"
  exit 1
fi

# Calculate
Xaxis=$(xrandr -q | grep '*' | uniq | awk '{print $1}' | cut -d 'x' -f1)
Yaxis=$(xrandr -q | grep '*' | uniq | awk '{print $1}' | cut -d 'x' -f2)

# Dispatch with vertical offset
#ffmpeg -f x11grab -r 25 -s 1366x752 -i :0.0+0,16 -vcodec libx264 -vpre lossless_ultrafast -threads 0 $OUT

# Dispatch
#ffmpeg -f x11grab -r 25 -s 1366x752 -i :0.0 -vcodec libx264 -vpre lossless_ultrafast -threads 0 $OUT

# Run
ffmpeg -f x11grab -s $(($Xaxis))x$(($Yaxis)) -r 25 -i :0.0 -qscale 0 $OUT