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

Is that possible to initial a SSAevent object directly? #86

Closed
another1s opened this issue Mar 21, 2024 · 2 comments
Closed

Is that possible to initial a SSAevent object directly? #86

another1s opened this issue Mar 21, 2024 · 2 comments
Assignees
Labels

Comments

@another1s
Copy link

Hello, i am currently working on converting some texts into a srt file. Intunitily i created a SSAFile object and assigned a list of SSAevent to it's attribute, but it seems like the timestamp of each SSAevent cannot be displayed properly which remain to be 0:00:00 .

that is pretty weird, since i have already set up start and end for all the SSAevent. Can you help me to fix it

@tkarabela tkarabela self-assigned this May 4, 2024
@tkarabela
Copy link
Owner

Hi @another1s , here is an example of creating a subtitle file from scratch:

from pysubs2 import SSAFile, SSAEvent, make_time

subs = SSAFile()
subs.append(SSAEvent(start=make_time(s=5), end=make_time(s=10), text="First subtitle"))
subs.append(SSAEvent(start=make_time(s=120), end=make_time(s=140), text="Second subtitle"))

subs.save("output.srt")

This produces SRT file:

1
00:00:05,000 --> 00:00:10,000
First subtitle

2
00:02:00,000 --> 00:02:20,000
Second subtitle

@another1s
Copy link
Author

Hi @another1s , here is an example of creating a subtitle file from scratch:

from pysubs2 import SSAFile, SSAEvent, make_time

subs = SSAFile()
subs.append(SSAEvent(start=make_time(s=5), end=make_time(s=10), text="First subtitle"))
subs.append(SSAEvent(start=make_time(s=120), end=make_time(s=140), text="Second subtitle"))

subs.save("output.srt")

This produces SRT file:

1
00:00:05,000 --> 00:00:10,000
First subtitle

2
00:02:00,000 --> 00:02:20,000
Second subtitle

It works. Thank you!

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

No branches or pull requests

2 participants