Skip to content
This repository has been archived by the owner on May 12, 2023. It is now read-only.

jwodder/ttyrec2video

Repository files navigation

Project Status: Abandoned – Initial development has started, but there has not yet been a stable, usable release; the project has been abandoned and the author(s) do not intend on continuing development. CI Status MIT License

GitHub | Issues

ttyrec2video converts ttyrec files (recordings of terminal sessions, including timing data) to video files (MP4, WMV, and whatever other formats imageio's ffmpeg writer supports). You may be familiar with ttyrecs from their use in recording NetHack games on nethack.alt.org.

Installation

ttyrec2video requires Python 3.6 or higher to run and pip 19.0 or higher to install. You can install ttyrec2video and its dependencies by running:

python3 -m pip install git+https://github.com/jwodder/ttyrec2video.git

Installing inside a virtual environment is recommended.

Note that ttyrec2video uses imageio, which in turn needs the ffmpeg program in order to create videos. If you don't have a suitable version of ffmpeg already installed, one will be downloaded for the program to use instead.

Usage

ttyrec2video [<options>] <ttyrec>[.gz|.bz2] [<outfile>]

<ttyrec> may be either a path to a local ttyrec file or an HTTP(S) URL pointing to a remote ttyrec. Files compressed with gzip or bzip2 will be uncompressed automatically.

If no output filename is supplied, the resulting video is written to the input filepath/URL basename with its extension changed to ".mp4."

Options

-E ENCODING, --encoding ENCODING
 Specify the character encoding to use for reading the ttyrec file's text; defaults to UTF-8
--font-file TTF-FILE
 Specify the path to a TrueType font (.ttf) file containing the font to use for rendering normal (non-bold) text. The font is assumed to be monospaced. The default is to use the Ubuntu Monospace font.
--bold-font-file TTF-FILE
 Specify the path to a TrueType font (.ttf) file containing the font to use for rendering bold text. The font is assumed to be monospaced. The default is to use the bold Ubuntu Monospace font.
--font-size INT
 Set the font size (in points) of rendered text; defaults to 16
--fps INT Set the FPS (frames per second) rate of the output video; defaults to 12
--ibm Synonym for "--encoding cp437" (CP437 is the character encoding used by NetHack's IBMgraphics option)
--info Instead of converting the ttyrec file to a video, output the ttyrec's total duration and number of screen updates as a JSON object
--info-all Like --info, but also include a list of the time & byte offsets of each screen update
--size COLUMNS_LINES
 [Specify COLUMNS and LINES as separate arguments] Set the dimensions of the terminal screen on which the ttyrec was recorded; defaults to 80×24

Licenses

The source code for ttyrec2video is licensed under the MIT license.

ttyrec2video contains a bundled copy of the Ubuntu Monospace font, regular and bold weight, version 0.83, copyright 2010, 2011 Canonical Ltd, licensed under the Ubuntu Font Licence, Version 1.0.