asciinema-edit
用于处理 ASCIINEMA 转换的辅助工具。
asciinema-edit 是一种工具,其目的是从 asciinema 本身或 termtosvg 进行后期处理的工具(V2)。
到目前为止,已实现了三个转换:
quantize(量化)
:根据量化范围更新转换延迟;和cut(剪切)
:删除一定范围的时间帧;speed(速度)
:以一定因素更新施法速度。
有了这些,您可以通过以下方法改善自己的转换:
- 加速不是很重要的部分;
- 减少命令之间的延迟; 和
- 完全去除那些无法为转换带来价值的部分。
安装
作为 Golang 应用程序,您可以使用go get自己构建它,也可以从 Releases 页面获取特定版本:
#Using `go`, fetch the latest from `master` go get -u -v github.com/cirocosta/asciinema-edit #Retrieving from GitHub releases VERSION=0.0.6 curl -SOL https://github.com/cirocosta/asciinema-edit/releases/download/$VERSION/asciinema-edit_$VERSION_linux_amd64.tar.gz
Quantize(量化)
NAME: asciinema-edit quantize -- 在量化范围后更新转换延迟。 该命令作用于帧之间的延迟,从而将此类时序降低到它们所在的给定范围内定义的最小值。 例如,考虑以下时间戳记: 1 2 5 9 10 11 假设我们对[2,6)进行量化,我们将2到6秒之间的任何延迟减少到2秒: 1 2 4 6 7 8 通过查看延迟量化,可以更轻松地将其可视化: delta = 1.000000 | qdelta = 1.000000 delta = 3.000000 | qdelta = 2.000000 delta = 4.000000 | qdelta = 2.000000 delta = 1.000000 | qdelta = 1.000000 delta = 1.000000 | qdelta = 1.000000 如果未将文件名指定为位置参数,则应通过 stdin 提供强制转换。 一旦执行了转换,生成的转换将写入'--out'标志中指定的文件或 stdout(默认)。 EXAMPLES: 使整个转换的最大延迟为2秒: asciinema-edit quantize --range 2 ./123.cast 使整个转换的时间延迟从300ms到1s减少到300ms,延迟在1s和2s之间减少到1s, 任何大于2s的延迟都减少到2s: asciinema-edit quantize \ --range 0.3,1 \ --range 1,2 \ --range 2 \ ./123.cast USAGE: asciinema-edit quantize [command options] [filename] OPTIONS: --range value quantization ranges (comma delimited) --out value file to write the modified contents to
Speed(速度)
NAME: asciinema-edit speed -- 通过一定的因素更新施法速度。 如果未将文件名指定为位置参数,则应通过stdin提供强制转换。 如果未指定范围(start=0, end=0),则处理整个事件流。 一旦执行了转换,生成的转换将写入'--out'标志中指定的文件或stdout(默认)。 EXAMPLES: 使整个转换(“123.cast”)的速度变慢两倍: asciinema-edit speed --factor 2 ./123.cast 将持续时间减少一半: asciinema-edit speed --factor 0.5 ./123.cast 仅使视频的某个部分慢一倍: asciinema-edit speed \ --factor 2 \ --start 12.231 \ --factor 45.333 \ ./123.cast USAGE: asciinema-edit speed [command options] [filename] OPTIONS: --factor value number by which delays are multiplied by (default: 0) --start value initial frame timestamp (default: 0) --end value final frame timestamp (default: 0) --out value file to write the modified contents to
Cut(剪切)
NAME: asciinema-edit cut -- 删除一定范围的时间帧。 如果未将文件名指定为位置参数,则应通过stdin提供强制转换。 一旦执行了转换,生成的转换将写入'--out'标志中指定的文件或stdout(默认)。 EXAMPLES: 从命令stdin中传递的强制转换中,将帧从12.2s到15.3s删除。 cat 1234.cast | \ asciinema-edit cut \ --start=12.2 --end=15.3 从名为1234.cast的转换文件中删除时间戳为12.2的确切帧。 asciinema-edit cut \ --start=12.2 --end=12.2 \ 1234.cast USAGE: asciinema-edit cut [command options] [filename] OPTIONS: --start value initial frame timestamp (required) (default: 0) --end value final frame timestamp (required) (default: 0) --out value file to write the modified contents to
(The first version translated by vz on 2020.07.26)