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 there a way to fix time delays in chat vs the video? #1

Open
mechalincoln opened this issue Jul 8, 2023 · 6 comments
Open

Is there a way to fix time delays in chat vs the video? #1

mechalincoln opened this issue Jul 8, 2023 · 6 comments

Comments

@mechalincoln
Copy link

Hey. I'm very happy with this project and it works great aside from one thing. Is it possible to have the script handle instances where the chat and the video don't perfectly line up, e.g. the chat is eight minutes ahead from the start, trigger the chat to actually play normally when the video starts? Or have a delay function or some sort?

Thanks again.

@hizkifw
Copy link
Contributor

hizkifw commented Jul 8, 2023

Hi, we don't have that feature yet. You'll need to write a script to update the timestamps in the chat file.

@mechalincoln
Copy link
Author

Do you know what that would entail if I wanted to do that on my side, and/or when new features would be added to this project?

Thank you.

@hizkifw
Copy link
Contributor

hizkifw commented Jul 8, 2023

You can check the chat json file. It's usually an array with timestamps in each of the array element
image
You can write a script to read the json file, update the timestamps, and then write it again.

import json

# example, make chat run 10 seconds earlier
offset = -10

with open('input.chat.json', 'r') as f:
    chat = json.load(f)

for item in chat:
    if 'time_in_seconds' in item:
        item['time_in_seconds'] -= offset

with open('output.chat.json', 'w') as f:
    json.dump(chat, f)

I haven't tested the code, you'll need to change it according to your needs

@mechalincoln
Copy link
Author

Thank you again.

Is the above a shell script?

@hizkifw
Copy link
Contributor

hizkifw commented Jul 9, 2023

It's a python script. Save it as a .py file and run it from the terminal (Powershell/cmd)

python ./script.py

Put the chat JSON files next to the script file and make sure the script opens the correct file names.

If you don't have Python installed you can get it from https://www.python.org/. When installing don't forget to check the option to add Python to the PATH.

@mechalincoln
Copy link
Author

I'll try that out soon.

Thank you again for your help.

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

No branches or pull requests

2 participants