Plaster
New
List
Login
common-lisp
default
anonymous
2021.02.08 18:19:04
(defun get-screen-dimensions-v1 () ;; You might be surprised that every command except the first is in Lisp. (car (! "xdpyinfo | grep -c dimensions | cut -f 7 -r \"[ ]\" -C | caar"))) (defun get-screen-dimensions-v2 () (xtools:with-open-display () (let ((screen (xlib:display-default-screen xtools:*display*))) (format nil "~dx~d" (xlib:screen-width screen) (xlib:screen-height screen))))) (defvar *recording-job* nil) (defun stop-recording () (uos:kill (job-pid (or *recording-job* (find-job "ffmpeg"))) uos:+SIGTERM+)) (defun screencast2 (&key (video-framerate 60) (audio-framerate 30)) (let* ((output-file (nos:path-append (nos:env "HOME") (s+ (date-string :format :filename) "_screencast.mp4")))) (!= "ffmpeg" "-hide_banner" "-nostats" "-y" "-f" "x11grab" "-framerate" video-framerate "-video_size" (get-screen-dimensions) "-i" (nos:env "DISPLAY") "-f" "alsa" "-i" "hw:0" "-r" audio-framerate "-c:v" "h264" "-crf" "0" "-preset" "ultrafast" "-c:a" "aac" output-file "&") (setf *recording-job* (lish-last-background-job *shell*))))
Raw
Annotate
Repaste
Edit