From 4566ec69d269ecba8d9386a131b932ee5244aa8e Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Sun, 5 May 2024 09:23:58 -0500 Subject: enhancements, functions, tests, and misc enhancements - move accent-company to C-` and ensure it's on for org mode - re-enable narrow-to-region - turn on network repos by default - remove setq in company's use-package custom clause - increase company delay to .7 secs - recipe templates should have visibility show all - move video recordings code to separate module - move geiser-guile to prog-lisp functions - improve cj/reformat-region-or-buffer via restriction - improvements to test-format-region - adding tests for clear-blank-lines - Add prepend-lines and replace-fraction-glyphs functions - add cj/clear-blank-lines function - create cj/load-all-tests utility function tests - add keybinding for ert-run-tests-interactively - ensure ert libraries are available to load-all-tests - remove running the tests when evaluating the buffer - fix clear-blank-lines and adding better tests misc - updated packages - adding the luddite blog to elfeed - more abbrevs --- modules/record-desktop.el | 61 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 modules/record-desktop.el (limited to 'modules/record-desktop.el') diff --git a/modules/record-desktop.el b/modules/record-desktop.el new file mode 100644 index 00000000..6c5a4fac --- /dev/null +++ b/modules/record-desktop.el @@ -0,0 +1,61 @@ +;;; record-desktop.el --- Video Record desktop -*- lexical-binding: t; -*- + +;;; Commentary: +;; Use ffmpeg to video record your desktop. +;; with audio from mic and audio from default audio sink + +;; Note: video-recordings-dir is defined (and directory created) in +;; user-cosntants.el + +;;; Code: + +(defvar cj/video-recording-ffmpeg-process nil + "Variable to store the process of the ffmpeg recording.") + +(defun cj/video-recording-start (arg) + "Starts the ffmpeg recording. +If called with a prefix arg C-u, choose the location on where to save the +recording, otherwise use the default location in `video-recordings-dir'." + (interactive "P") + (let* ((location (if arg + (read-directory-name "Enter recording location: ") + video-recordings-dir)) + (directory (file-name-directory location))) + (unless (file-directory-p directory) + (make-directory directory t)) + (cj/ffmpeg-record location))) + +(defun cj/ffmpeg-record (directory) + "Start an ffmpeg recording. Save output to DIRECTORY." + (unless cj/video-recording-ffmpeg-process + (let* ((location (expand-file-name directory)) + (name (format-time-string "%Y-%m-%d-%H-%M-%S")) + (filename (concat location "/" name ".mkv")) + (ffmpeg-command + (concat "ffmpeg -framerate 30 -f x11grab -i :0.0+ " + "-f pulse -i " + "alsa_input.pci-0000_00_1b.0.analog-stereo " + "-ac 1 " + "-f pulse -i " + "alsa_output.pci-0000_00_1b.0.analog-stereo.monitor " + "-ac 2 " filename))) + ;; start the recording + (setq cj/video-recording-ffmpeg-process + (start-process-shell-command "ffmpeg-recording" + "*ffmpeg-recording*" + ffmpeg-command)) + (set-process-query-on-exit-flag cj/video-recording-ffmpeg-process nil) + (message "Started recording process.")))) + +(defun cj/video-recording-stop () + "Stop the ffmpeg recording process." + (interactive) + (when cj/video-recording-ffmpeg-process + (delete-process cj/video-recording-ffmpeg-process) + (setq cj/video-recording-ffmpeg-process nil) + (message "Stopped video recording."))) + + + +(provide 'record-desktop) +;;; record-desktop.el ends here. -- cgit v1.2.3