asciinema-edit

asciinema 转换后期制作工具。(asciinema casts post-production tools)

Github stars Tracking Chart

asciinema-edit

用于处理 ASCIINEMA 转换的辅助工具。

asciinema-edit 是一种工具,其目的是从 asciinema 本身或 termtosvg 进行后期处理的工具(V2)。

到目前为止,已实现了三个转换:

有了这些,您可以通过以下方法改善自己的转换:

  • 加速不是很重要的部分;
  • 减少命令之间的延迟; 和
  • 完全去除那些无法为转换带来价值的部分。

安装

作为 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)

Overview

Name With Ownercirocosta/asciinema-edit
Primary LanguageGo
Program languageMakefile (Language Count: 3)
PlatformLinux, Mac
License:MIT License
Release Count6
Last Release Name0.0.6 (Posted on 2018-07-10 18:50:03)
First Release Name0.0.1 (Posted on 2018-07-03 16:01:23)
Created At2018-07-02 12:56:39
Pushed At2023-06-28 22:07:22
Last Commit At2019-01-30 15:42:15
Stargazers Count305
Watchers Count6
Fork Count20
Commits Count63
Has Issues Enabled
Issues Count12
Issue Open Count8
Pull Requests Count8
Pull Requests Open Count5
Pull Requests Close Count1
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private

asciinema-edit is a tool who's purpose is to post-process asciinema casts (V2), either from asciinema itself or termtosvg.

Three transformations have been implemented so far:

  • quantize: Updates the cast delays following quantization ranges; and
  • cut: Removes a certain range of time frames;
  • speed: Updates the cast speed by a certain factor.

Having those, you can improve your cast by:

  • speeding up parts that are not very important;
  • reducing delays between commands; and
  • completely removing parts that don't add value to the cast.

Installation

Being a Golang application, you can either build it yourself with go get or fetch a specific version from the Releases page:

#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 - Updates the cast delays following quantization ranges.

   The command acts on the delays between the frames, reducing such
   timings to the lowest value defined in a given range that they
   lie in.

   For instance, consider the following timestamps:

      1  2  5  9 10 11

   Assuming that we quantize over [2,6), we'd cut any delays between 2 and
   6 seconds to 2 second:

      1  2  4  6  7  8

   This can be more easily visualized by looking at the delay quantization:

      delta = 1.000000
To the top