Ttyrec

Program and its file format


title: "Ttyrec" type: doc version: 1 created: 2026-02-28 author: "Wikipedia contributors" status: active scope: public tags: ["user-interfaces", "computer-file-formats", "unix-software"] description: "Program and its file format" topic_path: "technology/operating-systems" source: "https://en.wikipedia.org/wiki/Ttyrec" license: "CC BY-SA 4.0" wikipedia_page_id: 0 wikipedia_revision_id: 0

::summary Program and its file format ::

::figure[src="https://upload.wikimedia.org/wikipedia/commons/3/35/termrec_wwwwolf.png" caption="A ''[[NetHack]]'' recording being replayed using termrec"] ::

ttyrec is a program or its file format capable of recording the TTY output of a text-mode program together with timestamps and then replaying it.

It is widely used for example in the NetHack community for storing game replays.

It is similar to the script command, but also allows for pausing, slowing down or speeding up playback. It can also stream the recording on the network and be used to transfer files with uudecode.

Recorders and players

  • original ttyrec (Unix, abandoned)
  • ovh-ttyrec (Unix)
  • Term::TtyRec (Perl)
  • Term::TtyRec::Plus (Perl)
  • Tie::Handle::TtyRec (Perl)
  • termrec (Win32, Unix)

Playback only

  • TTYPLAYER (Java)
  • IPBT (Unix)

Technical file format specification

Each chunk consists of a header using 32bit unsigned little-endian numbers:

  • sec – seconds, either since the beginning of the recording (0-based) or since the Unix epoch
  • usec – 0..999999 microseconds
  • len – length of the payload and the actual payload written as text with vt100 control codes.

The 32-bit sec range makes the format susceptible to the Year 2038 problem.

The format does not contain any information about the character set used nor about the terminal size needed to play back the file. termrec will inject this information as \e for UTF-8 or \e for not UTF-8 and as \eYX for size, but not all players will understand these codes.

Related formats

  • nh-recorder
  • Joey Hess's modifications of script
  • RealLogs

References

References

  1. "Ttyrec: A tty recorder".
  2. "ovh/ovh-ttyrec: Enhanced (but compatible) version of the classic ttyrec".
  3. "Term::TtyRec - handles ttyrec data - metacpan.org".
  4. "Term::TtyRec::Plus - read a ttyrec - metacpan.org".
  5. "Tie::Handle::TtyRec - write a ttyrec - metacpan.org".
  6. "1KB: Software/Termrec".
  7. "Ttyplayer".
  8. "IPBT: A high-tech ttyrec player for Unix".
  9. "Nethack Recorder/Player Version 1.0".
  10. "#68556 - [patch] adding timings to script - Debian Bug report logs".

::callout[type=info title="Wikipedia Source"] This article was imported from Wikipedia and is available under the Creative Commons Attribution-ShareAlike 4.0 License. Content has been adapted to SurfDoc format. Original contributors can be found on the article history page. ::

user-interfacescomputer-file-formatsunix-software