Using animated gifs are a lightweight way to show Emacs in action, as can be seen at Emacs Gifs.
There are several different ways to create animated gifs and so far I have found camcorder.el to be the easiest. This approach has been tested on Ubuntu Linux 16.10.
Being an image format, animated gifs can be used like any other image. So they are easy to include in websites. They will also play continually without any additional code.
Animated gifs are typically smaller in size, so are quicker to download than video and use less resources too.
Some small amount of quality is lost when converting to an animated gif. However, using the optimised and hence slower conversion gives a reasonable quality. I am still experimenting with the setting though to see if I can make the conversion better.
camcorder.el enables you to create a screen capture specifically of Emacs. When run, a new Emacs frame is created with the contents of the current buffer and your actions in that frame are recorded as a video.
Then camcorder.el can convert the video to an animated gif.
camcorder.el package itself does not actually do the recording or even the converting, its simply a convienient way to manage other tools without having to leave Emacs.
- recordmydesktop - a linux based video & audio recorder
- mplayer - movie player and converter
- imagemagick - create, edit, compose, or convert bitmap images
- ffmpeg - video conversion tools
For a quick and simple conversion from video to animated gif you can select ffmpeg. If you want to optimise the size of the resulting animated gif then select the combination of mplayer and imagemagick.
As far as I am aware there is not yet a Spacemacs layer that includes
camcorder.el. So instead we add
camcorder.el as an additional package.
~/.spacemacs configuration file and find
dotspacemacs-additional-packages. Then add
camcorder to that list of packages:
You will need to either reload your Spacemacs configuration with
SPC f e R or restart Emacs.
camcorder-mode to record Emacs. You are first prompted to give the file name of the video output (
ogv video format).
Once you have specified the video name, a 3 second countdown will run before starting the recording.
||Open a new Emacs frame and record|
||Record current Emacs frame|
||Toggle pause pause|
||Stop recording and save video|
Screencasts are generated in ogv format, although if you hack
camcorder.el you could change the video format used and even the video capture tool (recordmydesktop).
As capturing creates a video file, you can edit that file with tools such as OpenShot or Blender video editors. So if you make a small error or want to shorten (or lengthen) a part of the video, then edit it before you convert it to gif.
You can convert the videos you generated during capturing, or any other supported video type. So you can also used
camcorder.el if you recorded Emacs (or other tools) separately.
M-x camcorder-convert-to-gif and you are prompted for the video file to convert to an animated gif.
I only made one tweak to
camcorder.el, to change the size of the frame created for the capture.
I changed the height from 20 to 32 and the width from 65 to 120. These sizes provided more space to see the Spacemacs menu as I demonstrate features. When creating screen captures I run my desktop at a resolution of 1360x768 and a Spacemacs font size of 16 (Ubuntu Mono).
The package camcorder.el provides a simple 2-step process to create animated gif images of Emacs demos. You can tweak the script easily and can also use different tools to do the screen capture.
Animated gifs are very easy to distribute, especially on web pages and github pages sites. With this process you also have a video version of the demo too.
Keeping your demos short, between 10 and 20 seconds, typically makes the animated gifs easy to follow. So think about what the most important point you are trying to convey when you are creating a new animated gif.
This work is licensed under a Creative Commons Attribution 4.0 ShareAlike License, including custom images & stylesheets. Permissions beyond the scope of this license may be available at @jr0cket