Skip to content

Commit cedc599

Browse files
author
Ciro S. Costa
committed
Improves quantize help, Updates readme
1 parent 6c4527b commit cedc599

File tree

3 files changed

+166
-24
lines changed

3 files changed

+166
-24
lines changed

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2018 Ciro da Silva da Costa
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+125-21
Original file line numberDiff line numberDiff line change
@@ -10,42 +10,128 @@
1010
<img width="100%" src="/.github/asciinema-edit-overview.svg" alt="Illustration of how ASCIINEMA-EDIT works" />
1111
</p>
1212

13+
Three transformations have been implemented so far:
1314

15+
- [`quantize`](#quantize): Updates the cast delays following quantization ranges; and
16+
- [`cut`](#cut): Removes a certain range of time frames;
17+
- [`speed`](#speed): Updates the cast speed by a certain factor.
1418

19+
### Quantize
20+
21+
```sh
22+
NAME:
23+
asciinema-edit quantize - Updates the cast delays following quantization ranges.
24+
25+
The command acts on the delays between the frames, reducing such
26+
timings to the lowest value defined in a given range that they
27+
lie in.
28+
29+
For instance, consider the following timestamps:
30+
31+
1 2 5 9 10 11
32+
33+
Assuming that we quantize over [2,6), we'd cut any delays between 2 and
34+
6 seconds to 2 second:
35+
36+
1 2 4 6 7 8
37+
38+
This can be more easily visualized by looking at the delay quantization:
39+
40+
delta = 1.000000 | qdelta = 1.000000
41+
delta = 3.000000 | qdelta = 2.000000
42+
delta = 4.000000 | qdelta = 2.000000
43+
delta = 1.000000 | qdelta = 1.000000
44+
delta = 1.000000 | qdelta = 1.000000
45+
46+
If no file name is specified as a positional argument, a cast is
47+
expected to be serverd via stdin.
48+
49+
Once the transformation has been performed, the resulting cast is
50+
either written to a file specified in the '--out' flag or to stdout
51+
(default).
52+
53+
EXAMPLES:
54+
Make the whole cast have a maximum delay of 1s:
55+
56+
asciinema-edit quantize --range 2 ./123.cast
57+
58+
Make the whole cast have time delays between 300ms and 1s cut to
59+
300ms, delays between 1s and 2s cut to 1s and any delays bigger
60+
than 2s, cut down to 2s:
61+
62+
asciinema-edit quantize \
63+
--range 0.3,1 \
64+
--range 1,2 \
65+
--range 2 \
66+
./123.cast
67+
68+
USAGE:
69+
asciinema-edit quantize [command options] [filename]
70+
71+
OPTIONS:
72+
--range value quantization ranges (comma delimited)
73+
--out value file to write the modified contents to
74+
75+
```
76+
77+
### Speed
78+
79+
```sh
1580
NAME:
16-
asciinema-edit - edit recorded asciinema casts
81+
asciinema-edit speed - Updates the cast speed by a certain factor.
82+
83+
If no file name is specified as a positional argument, a cast is
84+
expected to be serverd via stdin.
85+
86+
If no range is specified (start=0, end=0), the whole event stream
87+
is processed.
88+
89+
Once the transformation has been performed, the resulting cast is
90+
either written to a file specified in the '--out' flag or to stdout
91+
(default).
92+
93+
EXAMPLES:
94+
Make the whole cast ("123.cast") twice as fast:
1795
18-
INSTALL
19-
Using `go`, fetch the latest from `master`
96+
asciinema-edit speed --factor 2 ./123.cast
2097
21-
go get -u -v github.com/cirocosta/asciinema-edit
98+
Cut the speed in half:
2299
23-
Retrieving from GitHub releases
100+
asciinema-edit speed --factor 0.5 ./123.cast
24101
25-
VERSION=0.0.1
26-
curl -SOL https://github.com/cirocosta/asciinema-edit/releases/download/$VERSION/asciinema-edit_$VERSION_linux_amd64.tar.gz
102+
Make only a certain part of the video twice as fast:
103+
104+
asciinema-edit speed \
105+
--factor 2 \
106+
--start 12.231 \
107+
--factor 45.333 \
108+
./123.cast
27109
28110
USAGE:
29-
asciinema-edit [global options] command [command options] [arguments...]
111+
asciinema-edit speed [command options] [filename]
112+
113+
OPTIONS:
114+
--factor value number by which delays are multiplied by (default: 0)
115+
--start value initial frame timestamp (default: 0)
116+
--end value final frame timestamp (default: 0)
117+
--out value file to write the modified contents to
118+
```
30119
31-
VERSION:
32-
dev
33120
34-
DESCRIPTION:
35-
asciinema-edit provides missing features from the "asciinema" tool
36-
when it comes to editing a cast that has already been recorded.
121+
### Cut
37122
38-
COMMANDS:
39-
cut Removes a certain range of time frames.
123+
```sh
124+
NAME:
125+
asciinema-edit cut - Removes a certain range of time frames.
40126
41-
If no file name is specified as a positional argument a cast is
127+
If no file name is specified as a positional argument, a cast is
42128
expected to be served via stdin.
43129
44130
Once the transformation has been performed, the resulting cast is
45131
either written to a file specified in the '--out' flag or to stdout
46132
(default).
47133
48-
EXAMPLES
134+
EXAMPLES:
49135
Remove frames from 12.2s to 16.3s from the cast passed in the commands
50136
stdin.
51137
@@ -59,8 +145,26 @@ EXAMPLES
59145
asciinema-edit cut \
60146
--from=12.2 --to=12.2 \
61147
1234.cast
62-
help, h Shows a list of commands or help for one command
63148
64-
GLOBAL OPTIONS:
65-
--help, -h show help
66-
--version, -v print the version
149+
USAGE:
150+
asciinema-edit cut [command options] [filename]
151+
152+
OPTIONS:
153+
--start value initial frame timestamp (required) (default: 0)
154+
--end value final frame timestamp (required) (default: 0)
155+
--out value file to write the modified contents to
156+
```
157+
158+
159+
### Installation
160+
161+
Being a Golang application, you can either build it yourself with `go get` or fetch a specific version from the [Releases page](https://github.com/cirocosta/asciinema-edit/releases):
162+
163+
```sh
164+
#Using `go`, fetch the latest from `master`
165+
go get -u -v github.com/cirocosta/asciinema-edit
166+
167+
#Retrieving from GitHub releases
168+
VERSION=0.0.3
169+
curl -SOL https://github.com/cirocosta/asciinema-edit/releases/download/$VERSION/asciinema-edit_$VERSION_linux_amd64.tar.gz
170+
```

commands/quantize.go

+20-3
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,30 @@ var Quantize = cli.Command{
1515
Name: "quantize",
1616
Usage: `Updates the cast delays following quantization ranges.
1717
18-
If no file name is specified as a positional argument, a cast is
19-
expected to be serverd via stdin.
20-
2118
The command acts on the delays between the frames, reducing such
2219
timings to the lowest value defined in a given range that they
2320
lie in.
2421
22+
For instance, consider the following timestamps:
23+
24+
1 2 5 9 10 11
25+
26+
Assuming that we quantize over [2,6), we'd cut any delays between 2 and
27+
6 seconds to 2 second:
28+
29+
1 2 4 6 7 8
30+
31+
This can be more easily visualized by looking at the delay quantization:
32+
33+
delta = 1.000000 | qdelta = 1.000000
34+
delta = 3.000000 | qdelta = 2.000000
35+
delta = 4.000000 | qdelta = 2.000000
36+
delta = 1.000000 | qdelta = 1.000000
37+
delta = 1.000000 | qdelta = 1.000000
38+
39+
If no file name is specified as a positional argument, a cast is
40+
expected to be serverd via stdin.
41+
2542
Once the transformation has been performed, the resulting cast is
2643
either written to a file specified in the '--out' flag or to stdout
2744
(default).

0 commit comments

Comments
 (0)