summaryrefslogtreecommitdiff
path: root/modules/record-desktop.el
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2024-05-05 09:23:58 -0500
committerCraig Jennings <c@cjennings.net>2024-05-05 09:34:19 -0500
commit4566ec69d269ecba8d9386a131b932ee5244aa8e (patch)
treefa00edae4ba8c93eee7861fa795052511d4e0f29 /modules/record-desktop.el
parent5f19638abc20eb24511a4129df2be09e1554591c (diff)
downloaddotemacs-4566ec69d269ecba8d9386a131b932ee5244aa8e.tar.gz
dotemacs-4566ec69d269ecba8d9386a131b932ee5244aa8e.zip
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
Diffstat (limited to 'modules/record-desktop.el')
-rw-r--r--modules/record-desktop.el61
1 files changed, 61 insertions, 0 deletions
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.