Một mục mã nguồn mở trong kho dữ liệu GitHub của TopGit: chjj/ttystudio, 3.2k sao, JavaScript. A terminal-to-gif recorder minus the headaches.
Tóm tắt dựng từ metadata GitHub của chính dự án — chưa có bài review TopGit. Trang sẽ tự động cập nhật khi bài review đầy đủ được xuất bản.
VÌ SAO CHƯA CÓ REVIEW
TopGit viết bài đầy đủ cho repo có nhiều sao nhất và được yêu cầu nhiều nhất. Trang này là snapshot trong thời gian chờ — xem README gốc ở tab READ ME.
Record your terminal and compile it to a GIF or APNG without any external
dependencies, bash scripts, gif concatenation, etc.
Install with: $ npm install ttystudio. (Add -g for global install).
Usage
$ ttystudio output.gif --log
$ vim
hello world
:q!
$ ^Q # stop recording with ctrl-q
initializing writer
writing image
writing head
writing frame 0 - 132 left
writing frame 1 - 131 left
writing frame 2 - 130 left
...
writing frame 131 - 1 left
writing eof
wrote image to /home/chjj/output.gif
$ chromium output.gif
# or if you wrote to output.png (an APNG)
$ firefox output.png
The Difference
ttystudio differs from other terminal recorders in that:
It has its own built-in gif and apng writer, no imagemagick required. The
writer now has built-in frame offset optimization.
It has a font parser to render the font during image writing so no terminal
playback is required when writing the image (this also means no GUI is
required at all - you can record on a remote machine via ssh).
No concatenation of hundreds of gif files required. ttystudio automatically
writes out to one gif or apng.
No glitchy frames due to imperfect GUI recording of the playback or gif
concatenation.
ttystudio will record frames even if nothing is being updated on the screen.
This project has ended up making use of years of work I've done writing
terminal libraries (my personal obsession). Once all the pieces were there,
this project became possible. It also sprang out of a need to find a
terminal-to-gif recorder that actually worked.
(NOTE: The above .gif was recorded with ttystudio - nested ttystudio
instances cause a slight glitch where the cursor is not visible. Not to matter
in most cases).
More Usage
$ ttystudio output.gif --log # record and compile
$ ttystudio frames.json --log # record
$ ttystudio frames.json output.gif --range=0-50 # compile
Use a frames.json file
$ ttystudio --record frames.json --interval=100 # grab each frame on a 100ms interval
$ vim
hello world
:q!
$ ^Q # stop recording with ctrl-q
$ ttystudio --compile frames.json output.gif --log
parsing json
initializing writer
writing image
writing head
writing frame 0 - 132 left
writing frame 1 - 131 left
writing frame 2 - 130 left
...
writing frame 131 - 1 left
writing eof
wrote image to /home/chjj/output.gif
$ chromium output.gif
# or if you wrote to output.png (an APNG)
$ firefox output.png
How it works
$ ttystudio --record frames.json:
blessed+term.js+pty.js will spawn a
pseudo-terminal to let you record until you press ^Q.
$ ttystudio --compile frames.json output.gif: ttystudio will parse each set of
frames into a bitmap, keeping in mind the foreground color and character in
each cell.
It will use its parsed font (terminus-u14n/b by default) to render pixels
for each characters in the image.
It will write out each frame to a .gif or .png file of your choice.
It's that simple. No bash script to run. No gifs to concatenate. No external
dependencies required (i.e. ffmpeg or imagemagick) - ttystudio does it all on
its own, in 99% javascript (aside from pty.js which is a node c++ binding to
spawn terminals).
Options and Examples
Compiling to APNG:
$ ttystudio frames.json output.png --log
Accidentally recorded something you don't want in your image? The range
option can help:
# compile only frames 5 to 130
$ ttystudio frames.json output.gif --log --range=5-130
The delay option sets the delay between frames in the final image:
The --no-palette/--rgba option can be used to avoid use a global palette
(color type 3) when compiling APNGs (this is known to cause high memory usage
when building the palette since it has to parse every frame beforehand).
Instead, it will use color type 6 (RGBA). This will make the APNG larger, but
does not risk OOMing the process. OOMing the process is unlikely to happen, but
if it does, this option is here. Use pngcrush afterwards to optimize.
$ ttystudio frames.json output.png --log --rgba
Piping:
$ ttystudio frames.json - | feh -
Replaying frames in the terminal:
$ ttystudio --play frames.json
Adding a border:
# explanation of arguments:
$ ttystudio output.gif --log --border=[width],[r],[g],[b],[a]
# add a red border:
$ ttystudio output.gif --log --border=10,255,0,0,255
# white border:
$ ttystudio output.gif --log --border=10,255
$ ttystudio output.gif --log --border=10,255,255,255
$ ttystudio output.gif --log --border=10
Start in screenshot mode. This allows you to take multiple screenshot whenever
C-p is pressed. ttystudio will write them all to separate images.
Choose a bold BDF font in ttystudio's JSON format.
-d, --delay [delay-ms]
Specify frame delay in ms (default: 100).
-i, --interval [interval-ms]
Specify frame snapshot interval in ms (default: 100).
-k, --key [quit-key]
Choose a key combination to quit recording (default: C-q).
-n, --num-plays [num-plays]
Specify a number of plays for the animation (default: 0 - infinite).
-r, --range [frame-range]
Choose a range of frames to compile. e.g. 5-200.
-x, --ratio [pixel-cell-ratio]
Choose pixel to cell ratio. This option is useless right now since it is
overwritten by the font (default: 8x14).
-t, --term [term-name]
Choose the terminal name for terminfo.
--palette
Use a global palette for APNGs instead of RGBA.
--no-palette, --rgba, --lct
Use RGBA for APNGs instead of a global palette. This will also avoid
building a global palette for GIFs and only use a local color table for
each frame.
--border [width,r,g,b,a]
Add a border around the animation using the specified parameters.
play, --play
Replay a frames file in the terminal.
record, --record
Explicitly choose to record (not very useful).
compile, --compile
Explicitly choose to compile (not very useful).
screenshot, --screenshot
Start ttystudio in screenshot mode. It will take a screenshot on C-p
unless specified otherwise by --screenshot-key.
--screenshot-key
Set the screenshot key when in screenshot mode. Default is C-p.
--version
Display ttystudio version.
-h, --help
Display help information.
Choosing a new font for your terminal recording
Since ttystudio does not record a GUI, it needs to know which font you want to
use (it has no real idea of the font your terminal is using). ttystudio uses
terminus (ter-u14n/b) by default, but you can change this.
Your font must be in BDF format. Once you have your font ready,
place it in the fonts/ directory in ttystudio and run $ make.
ttystudio+pxxl.js will convert the .bdf font to a glyph bitmap format in a
json file, which is what ttystudio uses.
pty.js seems to currently be causing sporadic input lag on
OSX. This is being investigated.
Notes
A special thanks to the folks who developed pxxl.js - a BDF font
parser. Without them, it would not have been possible to render a reasonable
looking font to the output gif/png.
Todo
More fonts and font formats supported.
Antialiased fonts.
Emit frames as events in writers.
Contribution and License Agreement
If you contribute code to this project, you are implicitly allowing your code
to be distributed under the MIT license. You are also implicitly verifying that
all code is your original work. </legalese>
License
Copyright (c) 2015, Christopher Jeffrey. (MIT License)
chjj/ttystudio có 3.2k sao GitHub — tải lại trang để xem số mới nhất, hoặc xem trực tiếp github.com/chjj/ttystudio. TopGit phản chiếu số sao của GitHub nhưng không cam kết đến từng phút.
chjj/ttystudio có phải mã nguồn mở không?
TopGit chưa ghi nhận license cho chjj/ttystudio. Phần lớn repo public trên GitHub là mã nguồn mở, nhưng điều khoản khác nhau từng repo — mở file LICENSE để xác nhận.
chjj/ttystudio có tag gì không?
Bản đồng bộ chưa ghi nhận topic GitHub nào cho chjj/ttystudio. GitHub topics hiển thị ở thanh bên phải trang repo — đó là nơi đáng kiểm tra nhất.
chjj/ttystudio có website riêng không?
TopGit chưa ghi nhận URL trang chủ cho chjj/ttystudio. Phần README ở tab phía trên thường có link demo, hoặc xem mô tả GitHub của repo.
chjj/ttystudio còn đang phát triển không?
Commit gần nhất trên chjj/ttystudio là 9.4 năm trước (theo timestamp GitHub). Repo có 92 fork — một chỉ báo về mức độ quan tâm của cộng đồng.
Đọc thêm về chjj/ttystudio ở đâu?
Trang TopGit này là một snapshot — tab "Readme" hiển thị nguyên văn README của repo (đã bỏ link, giữ ảnh). Repo GitHub ở github.com/chjj/ttystudio là nguồn chính thức.
Đọc đầy đủ README ở tab phía trên.
Muốn nghe thêm một ý kiến về ttystudio?
Hỏi một AI đọc được trang này — một cú bấm là có ngay nhận định về ttystudio.