Skip to content
This repository has been archived by the owner on Feb 6, 2022. It is now read-only.

Does libjass have any function to change timing on a fly? #90

Open
XCanG opened this issue May 19, 2017 · 2 comments
Open

Does libjass have any function to change timing on a fly? #90

XCanG opened this issue May 19, 2017 · 2 comments

Comments

@XCanG
Copy link

XCanG commented May 19, 2017

The thing is I know website where libjass is used, also it have video and subtitles for it, but that subtitles are not syncronized (need add about +2 seconds to every line), I can't change any website resourses, but, will be great if I can call function from libjass what will automatically retime every line, something like assObject.setTimeShifting(2000); (+2000 ms, may be negative).

I check API and don't find function, so it looks like it not exist. Would be great having something like that in this library.

@Arnavion
Copy link
Owner

Arnavion commented May 19, 2017

There's no public API for it. One workaround is that once you have the ASS object, you can iterate over each Dialogue in ass.dialogues and change its _start and _end private properties.

var ass = libjass.ASS.fromUrl(...).then(ass => { shift(ass, 2.000); return ass; });

function shift(ass, time) {
    for (const dialogue of ass.dialogues) {
        dialogue._start += time;
        dialogue._end += time;
    }
}

@XCanG
Copy link
Author

XCanG commented May 20, 2017

Will be something like that added in API or not?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants