diff options
author | Akshay <[email protected]> | 2021-09-26 16:56:36 +0100 |
---|---|---|
committer | Akshay <[email protected]> | 2021-09-26 16:56:36 +0100 |
commit | 5cdb4e421a809de51c3ebe8404e50d732721238b (patch) | |
tree | 73b71617c41b3e13edbf26035e821bb884d30441 /scripts/record.nix |
init
Diffstat (limited to 'scripts/record.nix')
-rw-r--r-- | scripts/record.nix | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/scripts/record.nix b/scripts/record.nix new file mode 100644 index 0000000..d5bfff5 --- /dev/null +++ b/scripts/record.nix | |||
@@ -0,0 +1,33 @@ | |||
1 | { pkgs, ...}: | ||
2 | |||
3 | let | ||
4 | name = "record"; | ||
5 | slop = "${pkgs.slop}/bin/slop"; | ||
6 | ffmpeg = "${pkgs.ffmpeg}/bin/ffmpeg"; | ||
7 | in | ||
8 | pkgs.writeScriptBin name | ||
9 | '' | ||
10 | echo starting recording ... | ||
11 | coords=$(${slop} -f "%x %y %w %h %g %i") || exit 1 | ||
12 | read -r X Y W H G ID < <(echo $coords) | ||
13 | ${ffmpeg} \ | ||
14 | -f x11grab \ | ||
15 | -s "$W"x"$H" \ | ||
16 | -i :0.0+$X,$Y \ | ||
17 | -f alsa \ | ||
18 | -thread_queue_size 512 \ | ||
19 | -ac 2 \ | ||
20 | -ar 48000 \ | ||
21 | -i hw:0 \ | ||
22 | -framerate 60 \ | ||
23 | -vcodec libx264 \ | ||
24 | -threads 4 \ | ||
25 | -y \ | ||
26 | /home/np/tmp/x.mkv | ||
27 | |||
28 | ${ffmpeg} \ | ||
29 | -i /home/np/tmp/x.mkv \ | ||
30 | -pix_fmt yuv420p \ | ||
31 | -vf scale=-2:1080 \ | ||
32 | "/home/np/vids/rec/$1" | ||
33 | '' | ||