all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Clément Pit--Claudel" <clement.pit@gmail.com>
To: Robert Weiner <rswgnu@gmail.com>
Cc: Eli Zaretskii <eliz@gnu.org>,
	Stefan Monnier <monnier@iro.umontreal.ca>,
	emacs-devel@gnu.org
Subject: Re: Redisplay hook
Date: Mon, 4 Jul 2016 17:00:18 -0400	[thread overview]
Message-ID: <577ACE62.8030504@gmail.com> (raw)
In-Reply-To: <7B54BCE8-0822-4BFF-A6B4-6A6284814CC8@gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 2319 bytes --]

On 2016-07-04 16:37, Robert Weiner wrote:
>> Additionally, since Emacs is driving, I can record plenty of
>> per-frame data, such as which key is being pressed with each frame.
>> Here's an example, which was fairly easy to assemble using this new
>> hook and a bit of ImageMagick:
>> http://web.mit.edu/cpitcla/www/emacs-screencast-annot.gif (it may
>> take a bit of time to load). What do you think of the result?
> 
> This is great and I would love to see this as a package and see it
> explained in more detail..  A simple way to capture Emacs
> screencasts, potentially with an audio overlay, would lead to many
> more demonstrations of Emacs packages leading to broader
> understanding and usage.

Thanks Bob :) Here's a quick outline of how it's done; hopefully we can
implement the necessary hook, and then I'll make an ELPA package out of it.

Essentially, my code adds two hooks:

- A pre-command-hook, to update a variable tracking (this-command-keys-vector)

- A post-display-hook, to capture screenshots.

The post-display hook records the current time and the current value of
(this-command-keys-vector), then synchronously calls ‘xwd’ to take a screenshot
(‘import’ would also work, but it is much slower). The resulting file name is
saved into a list of captured frames (annotated with the current time and value
of (this-command-keys-vector))

Finally, to finish the capture, I run a humongous ImageMagick command to stitch
together all frames and add text overlays.  The delay between consecutive frames
is computed using the timestamps recorded in each frame.

The implementation of the full thing is pretty short (about 200 lines), and it
works fairly well.  The one downside is that the temporary files that it
generates tend to take a lot of space (about 3.5MB per screenshot). Saving
compressed screenshots is possible, but it tends to slow Emacs down more
significantly.  Of course, one could imagine capturing uncompressed frames, and
compressing them in a separate thread; I have not investigated this option yet.
Alternatively, one could measure the time taken to capture the frame, and adjust
inter-frames delays in proportion when generating the movie.

I'll send the code once I have a bit of time to clean it up.

Cheers,
Clément.


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

  reply	other threads:[~2016-07-04 21:00 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-02 19:24 Redisplay hook Clément Pit--Claudel
2016-07-03  3:27 ` Eli Zaretskii
2016-07-03  4:36   ` Clément Pit--Claudel
2016-07-03  7:45     ` Eli Zaretskii
2016-07-03 14:23       ` Clément Pit--Claudel
2016-07-03 14:51         ` Clément Pit--Claudel
2016-07-03 15:37         ` Eli Zaretskii
2016-07-04  0:05       ` Clément Pit--Claudel
2016-07-04  2:41         ` Eli Zaretskii
2016-07-04  4:31           ` Clément Pit--Claudel
2016-07-04 14:47             ` Eli Zaretskii
2016-07-04 16:14               ` Clément Pit--Claudel
2016-07-04 16:24                 ` Eli Zaretskii
2016-07-04  7:55           ` Stefan Monnier
2016-07-04 14:52             ` Eli Zaretskii
2016-07-04 16:07             ` Clément Pit--Claudel
2016-07-04 20:37               ` Robert Weiner
2016-07-04 21:00                 ` Clément Pit--Claudel [this message]
2016-07-04 21:28                   ` Robert Weiner
2016-07-04 21:50                     ` Clément Pit--Claudel
2016-07-04 21:29                   ` Drew Adams
2016-07-04 21:36                     ` Clément Pit--Claudel
2016-07-04 21:57                   ` raman
2016-07-04 22:11                     ` Clément Pit--Claudel
2016-07-05 22:59                   ` Richard Stallman
2016-07-05 23:47                     ` Clément Pit--Claudel
2016-07-03 22:34   ` Richard Stallman
2016-07-04  0:09     ` Clément Pit--Claudel
2016-07-04  2:42       ` Eli Zaretskii
2016-07-04  0:22     ` Mark Oteiza
2016-07-04  2:42       ` Eli Zaretskii
2016-07-04  7:59         ` Andreas Schwab
2016-07-04 14:52           ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=577ACE62.8030504@gmail.com \
    --to=clement.pit@gmail.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=rswgnu@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.