summaryrefslogtreecommitdiff
path: root/vlog
blob: 3a4ace7b6ce38f380ea6bcfcb062f5057bd53d12 (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
#! /usr/bin/env nix-shell
#! nix-shell -i bash -p ffmpeg
#
# https://gist.github.com/dpacmittal/9f0e1aea8a3732d8f7aec7b1dadc8cda

FILE=$(date +%Y.%m.%d..%H.%M)
DIR=/mnt/lake/ben/videos
SIZE=1920x1080

OUTFILE="$DIR/$FILE.mkv"

echo "recording to: $OUTFILE"

ffmpeg \
  -f alsa -i default \
  -f x11grab -video_size "$SIZE" -r 48 -i :0.0+0,0 \
  -f video4linux2 -i /dev/video0 \
  -filter_complex '[2:v]scale=480:-1[cam];[1:v][cam]overlay=W-w-10:H-h-10' \
  -ab 192 -acodec pcm_s16le -qscale 0 \
  -c:v libx264 \
  -crf:v 18 \
  -c:a flac \
  -loglevel 5 \
  "$OUTFILE"