Day 11 — reveal-notes + tmux + keylogger = present-notes24 August 2020 · recurse-center Tweet
Today I spent most of my time recording the talk video for PyConline AU. I wanted to use present and since it doesn't have a speaker notes view right now, I managed to hack together a way to make the
reveal.js speaker notes work with
present. It worked out surpisingly well!
tmux to the rescue! Since it is configured to use 8 colors by default, I had to set it to use 256 colors (for better images) by adding
set -g default-terminal "screen-256color" to the
~/.tmux.conf. After that, I started a new
tmux session with
tmux new-session -s 1 and ran
present in it. I also had to set
tmux set-option status off to remove the status bar at the bottom. Post that, I opened the
reveal.js speaker notes view in the browser.
reveal.js support SPACEBAR to move to the next slide, I needed a way to detect this keypress at a global level, otherwise it would only change the slide on the window that was in focus. So I wrote this keylogger which ran
tmux send-keys -t 1 ' ' (whenever SPACEBAR was pressed on the
reveal.js speaker notes view) to change the slide in the session where
present was running.
# -*- coding: utf-8 -*- import os import pyxhook def OnKeyPress(event): if event.Key.lower() == "space": os.system("tmux send-keys -t 1 ' '") new_hook = pyxhook.HookManager() new_hook.KeyDown = OnKeyPress new_hook.HookKeyboard() try: new_hook.start() except KeyboardInterrupt: pass
Yes it is a hack, but it worked great. I've finally recorded a talk about terminals and CLIs, in a terminal using a CLI!
I used OBS Studio to record the video, and
ffmpeg to crop the two takes and join them. I love open source software!
Here are the
ffmpeg cropping commands. I did it in two steps for each take because I didn't want to do the mental math to calculate the
-t duration required to crop the videos.
$ ffmpeg -i 2020-08-25\ 01-31-40.mp4 -ss 00:01:36 -async 1 output1.mp4 $ ffmpeg -i output1.mp4 -t 00:15:28 -async 1 output2.mp4 $ ffmpeg -i 2020-08-25\ 02-42-37.mp4 -ss 00:00:33 -async 1 output3.mp4 $ ffmpeg -i output3.mp4 -t 00:07:28 -async 1 output4.mp4
And here is the
ffmpeg concat command, which assumes the existence of a file called
concat.txt containing a list of all the files that need to be joined. (
output4.mp4 in this case)
$ ffmpeg -f concat -i concat.txt -c copy output5.mp4
Tomorrow I want to dig into the Rust book!