Emacs Lisp: Record screen within GNU Emacs
The program third party program
recordmydesktop is used for this function to invoke screen recording within GNU Emacs. You may wish to make a demonstration in video and publish such online. Record it while using few keybindings or
M-x record-screen. This page is giving you the concept of a workflow. I consider workflow more important then the function itself. You please modify it to suit your own needs. The
screen-record-command is spitting out the actual screen recording command, customize it as you wish.
You are maybe doing something and wish to record the screen. You could record video to report GNU Emacs bug. You could make a presentation by using your GNU Emacs. Everything is possible. You can teach people your GNU Emacs skills or programming skills. Think about the screen cast within GNU Emacs. I know that some packages exists for this purpose and I have never tried them. Few functions are enough to have nice video recording. Publish your videos to decentralized social networks. Visit us as https://gnusocial.club or publish your videos over Indieweb.
How to use the function?
You would first make sure that you have the shell command
recordmydesktop. Once you have that one, you install the functions somewhere in your GNU Emacs environment. You could place it in the init file or special
media-utilities.el if you wish.
I have bound the function to Hyper key and z. It means when I press
s-z the screen recording starts. If I wish to quit screen recording, I press
At that point you are brought to the output of
recordmydesktop. Wait for output to finish and that process has finished.
At that moment, press
q two times. You will be brought to the recorded video.
Customize the directory for recorded videos as you wish. Be careful with your file system.
You may also get other video formats, change the video extension to suit your needs.
(defvar video-recordings-dir "/home/data1/protected/Media/Video/Recordings/" "This is your video recording directory. Keep slash on the end") (defvar video-recording-extension ".ogv" "This is your video file extension") (defun record-screen () "Records screencast. It is recommended to bind the function to a key. Press key to start screen recording. Program `recordmydesktop` is used but other screen recording command could be used as well. You could modify the keybinding to stop the recording. It is set to be Hyper-u. See below. Once you stop recording the video is being prepared. Wait that process finishes, then press `q` two times to remove the buffer and get to the recorded file." (interactive) (let* ((filepath (concat video-recordings-dir (format-time-string "%Y/%m/%Y-%m-%d/"))) (filename (concat filepath (format-time-string "%Y-%m-%d-%H:%M:%S") video-recording-extension)) (command-1 (screen-record-command filename)) (current-buffer (current-buffer)) (keybinding-stop (kbd "s-u")) (buffer "*Screen Recording*")) (make-directory filepath t) (switch-to-buffer buffer) (erase-buffer) (setq-local header-line-format "➜ Screen recording, use 'q' when process finishes to get the recorded file, use globally s-u to stop recording.") (let* ((process (start-process-shell-command buffer buffer command-1))) (message (prin1-to-string process)) (local-set-key "q" `(lambda () (interactive) (signal-process ,process 'TERM) (local-set-key "q" (lambda () (interactive) (kill-current-buffer) (find-file ,filepath) (revert-buffer))))) (switch-to-buffer current-buffer) (global-set-key keybinding-stop `(lambda () (interactive) (signal-process ,process 'TERM) (switch-to-buffer ,buffer)))))) (defun screen-record-command (filename &optional device) "Record screen with the default device" (let* ((device (if device device "pulse")) (command (format "recordmydesktop --pause-shortcut Alt-p --stop-shortcut Alt-n --workdir '%s' --no-frame --device %s -o \"%s\"" temporary-file-directory device filename))) command)) (global-set-key (kbd "s-z") 'record-screen)
The workflow concept could be improved so that video and voice files are quickly sent to the recipient by email. Maybe you wish to publish the GNU Emacs video screen cast to GNU Social network via Jabber or XMPP. You could improve the workflow to automatically publish the video to the web server and publish the status to GNU Social network. This demonstration presents a concept of chaining of various actions, so that we work with less keys, more productivity.
Contact GNU.Support now. There is a simple rule at GNU.Support: if we can help you, we do, whenever and wherever necessary, and it's the way we've been doing business since 2002, and the only way we know