From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: raman Newsgroups: gmane.emacs.devel Subject: Re: Redisplay hook Date: Mon, 04 Jul 2016 14:57:39 -0700 Message-ID: References: <577814F4.8060500@gmail.com> <8360sns8nj.fsf@gnu.org> <57789637.8020204@gmail.com> <83twg7qi5t.fsf@gnu.org> <5779A83D.6020201@gmail.com> <83twg6p1kd.fsf@gnu.org> <577A89CB.7050502@gmail.com> <7B54BCE8-0822-4BFF-A6B4-6A6284814CC8@gmail.com> <577ACE62.8030504@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1467669483 2149 80.91.229.3 (4 Jul 2016 21:58:03 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 4 Jul 2016 21:58:03 +0000 (UTC) Cc: Eli Zaretskii , Robert Weiner , Stefan Monnier , emacs-devel@gnu.org To: =?utf-8?Q?Cl=C3=A9ment?= Pit--Claudel Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Jul 04 23:58:01 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1bKBsO-0000S4-32 for ged-emacs-devel@m.gmane.org; Mon, 04 Jul 2016 23:58:00 +0200 Original-Received: from localhost ([::1]:50720 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bKBsN-0002tI-ET for ged-emacs-devel@m.gmane.org; Mon, 04 Jul 2016 17:57:59 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50264) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bKBsE-0002r4-KX for emacs-devel@gnu.org; Mon, 04 Jul 2016 17:57:51 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bKBsA-0008PC-Ht for emacs-devel@gnu.org; Mon, 04 Jul 2016 17:57:49 -0400 Original-Received: from mail-pf0-x234.google.com ([2607:f8b0:400e:c00::234]:35909) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bKBsA-0008P0-A7 for emacs-devel@gnu.org; Mon, 04 Jul 2016 17:57:46 -0400 Original-Received: by mail-pf0-x234.google.com with SMTP id t190so64042020pfb.3 for ; Mon, 04 Jul 2016 14:57:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=o0YPHBW2orLMIGuFeVNfc2+aJKvJuMSxrNN+XFUPFao=; b=fo3LN/zY5w20fBYAH472ohwbZvR/uiRQl7Zscf3eqAruO8KMkNWJ42X6kIal1SlPOu UaREwOm3oUcT3uABZcrPK/LekbwgBrG4eGUStt77NfbBBWjXngHkDzB+GTywGDOjeGqe 9dNBSKqdFLf8fsIVEvh9HrsLorqlAm8ppTFBN6SjSJg+2WaOpnxzPPraSGS2ImyzbJG5 bvW3OoC34EHoKjvcKO+LNQpPzqQkg7QfCEceXzXAiaOLTxlq1ob8maXBb/tT7j/i2eNp Uu2bmdAnm3IhykajouSZow8ATeN8bOkm96JKEaPk8VYkiXjYok8TM+u2E0iAFZb5AlJ+ 7W+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=o0YPHBW2orLMIGuFeVNfc2+aJKvJuMSxrNN+XFUPFao=; b=k71mZl6+YnNp3O7Q+YhrYbIQtzViilMH9iQQ0SPnquw6EcQCroXh+4QBGJsdKpNR+Z 85u2Y2DVC9dl5ya0SqO70Vp6sPwA5e1QFjbd4fapZlCgIgOOCKHN5D/uLORmk/0PnSI/ CyYMZiSounyFyXF0cUgKRESnIupc2zpXzy9pLVIrseQmMQCjSek5i5F316aRGsMp7iRJ npJTMZtD5Yo5kTb5H24z2m6FwK7Siw1NtxMZps5vFZRc3UYTA5cUMkxKoWYsF7LFivH2 FsfxP4BSyG3Z+1pHr2aA5HgPJMH9Pp9lm4/twZcAcORYlGyZY6Ihe8INzYsHYJyn7riE mOww== X-Gm-Message-State: ALyK8tL+sFmxO23bROJs9zg7COGyX0cGJzt0zV0yOVqaBUV2jZzwGWBXLoS5nVszc4qkTRPd X-Received: by 10.98.19.133 with SMTP id 5mr26015660pft.17.1467669463629; Mon, 04 Jul 2016 14:57:43 -0700 (PDT) Original-Received: from raman-glaptop2 (c-73-170-121-60.hsd1.ca.comcast.net. [73.170.121.60]) by smtp.gmail.com with ESMTPSA id yp4sm24781pab.48.2016.07.04.14.57.40 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Mon, 04 Jul 2016 14:57:41 -0700 (PDT) In-Reply-To: <577ACE62.8030504@gmail.com> (=?utf-8?Q?=22Cl=C3=A9ment?= Pit--Claudel"'s message of "Mon, 4 Jul 2016 17:00:18 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.95 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:400e:c00::234 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:205158 Archived-At: Cl=C3=A9ment Pit--Claudel writes: Could you try capturing audio as well? Would help recording demos of emacsp= eak:-)> 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? >>=20 >> 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 i= t. > > Essentially, my code adds two hooks: > > - A pre-command-hook, to update a variable tracking (this-command-keys-ve= ctor) > > - 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 =E2=80=98xwd=E2=80= =99 to take a screenshot > (=E2=80=98import=E2=80=99 would also work, but it is much slower). The re= sulting 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), a= nd 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 frame= s, and > compressing them in a separate thread; I have not investigated this optio= n 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=C3=A9ment. > --=20