From 5cdb4e421a809de51c3ebe8404e50d732721238b Mon Sep 17 00:00:00 2001 From: Akshay Date: Sun, 26 Sep 2021 21:26:36 +0530 Subject: init --- scripts/record.nix | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 scripts/record.nix (limited to 'scripts/record.nix') 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 @@ +{ pkgs, ...}: + +let + name = "record"; + slop = "${pkgs.slop}/bin/slop"; + ffmpeg = "${pkgs.ffmpeg}/bin/ffmpeg"; +in + pkgs.writeScriptBin name + '' + echo starting recording ... + coords=$(${slop} -f "%x %y %w %h %g %i") || exit 1 + read -r X Y W H G ID < <(echo $coords) + ${ffmpeg} \ + -f x11grab \ + -s "$W"x"$H" \ + -i :0.0+$X,$Y \ + -f alsa \ + -thread_queue_size 512 \ + -ac 2 \ + -ar 48000 \ + -i hw:0 \ + -framerate 60 \ + -vcodec libx264 \ + -threads 4 \ + -y \ + /home/np/tmp/x.mkv + + ${ffmpeg} \ + -i /home/np/tmp/x.mkv \ + -pix_fmt yuv420p \ + -vf scale=-2:1080 \ + "/home/np/vids/rec/$1" + '' -- cgit v1.2.3