Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quantize doesn't behave how I'm expecting it to #2

Closed
rmoff opened this issue Jul 5, 2018 · 2 comments
Closed

Quantize doesn't behave how I'm expecting it to #2

rmoff opened this issue Jul 5, 2018 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@rmoff
Copy link
Contributor

rmoff commented Jul 5, 2018

First off, thanks for a great tool! Perfect for what I need!

I'm trying to cut some long (~20 second) pauses from my cast (here)

I tried this:

~/go/bin/asciinema-edit quantize --range 2 /var/folders/q9/2tg_lt9j6nx29rvr5r5jn_bw0000gp/T/tmpkeskvzmm-ascii.cast 

But this didn't affect the length at all (147.826334 still the last frame).

If I specify additional ranges, it shortens it to ~130, but still with long pauses (over the 2 seconds max that I'm expecting)

~/go/bin/asciinema-edit quantize        --range 0.3,1        --range 1,2        --range 2 /var/folders/q9/2tg_lt9j6nx29rvr5r5jn_bw0000gp/T/tmpkeskvzmm-ascii.cast

I ended up using speed with start and end to isolate a particularly long pause to speed that up:

~/go/bin/asciinema-edit quantize        --range 0.3,1        --range 1,2        --range 2 /var/folders/q9/2tg_lt9j6nx29rvr5r5jn_bw0000gp/T/tmpkeskvzmm-ascii.cast | ~/go/bin/asciinema-edit speed --factor 0.1 --start 3.888742 --end 23.160987000000002

Am I using the parameters wrong?

Thanks!

@cirocosta
Copy link
Owner

cirocosta commented Jul 5, 2018

Hey @rmoff , I'm glad it's being useful for you! 😁

hmmmm I guess that's because in the first scenario it's not picking a default value for the case when you don't specify the end of the quantization range.

For instance, if you try --range 2,100000, it should work as you expect.

To solve that, the code could do something similar to what we do in speed:

func (t *speedTransformation) Transform(c *cast.Cast) (err error) {
if t.from == 0 && t.to == 0 {
t.from = c.EventStream[0].Time
t.to = c.EventStream[len(c.EventStream)-1].Time
}
err = editor.Speed(c, t.factor, t.from, t.to)
return
}

But then for quantize, instead, do something like:

func (t *quantizeTransformation) Transform(c *cast.Cast) (err error) {
         // for each t.range, if no upper bound specified, make it `math.MaxFloat64`
	err = editor.Quantize(c, t.ranges)
	return
}

Wdyt?

thx!


Update: here's your cast piped to asciinema-edit quantize --range 2,100000: cast

@cirocosta cirocosta added the bug Something isn't working label Jul 6, 2018
@cirocosta cirocosta self-assigned this Jul 6, 2018
@cirocosta
Copy link
Owner

Hey @rmoff ,

I just pushed #5 , it should work fine now 😁 I released it under 0.0.4.

Please let me know if it still doesn't work properly.

thx!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants