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

Subtitle synchronization with input video files. #93

Open
qaixerabbas opened this issue Feb 24, 2023 · 0 comments
Open

Subtitle synchronization with input video files. #93

qaixerabbas opened this issue Feb 24, 2023 · 0 comments

Comments

@qaixerabbas
Copy link

Hi everyone.

I have transcribed a video using transformers library. Now I have a temporary .txt file for video transcription. I am using pysrt for creating a .srt file for subtitles. I have created a .srt file successfully using following code.

srt_file = pysrt.SubRipFile()
srt_file.append(
    pysrt.SubRipItem(
        index=1,
        text=transcription,
        start=pysrt.SubRipTime(0, 0, 0),
        end=pysrt.SubRipTime(hours=0, minutes=0, seconds=59),
    )
)

and I am saving the resulting file using following line.
srt_file.save("video.srt", encoding="utf-8")

but I am not sure how to synchronize the video with the start and end time. I know that I can play with following two lines

        start=pysrt.SubRipTime(0, 0, 0),
        end=pysrt.SubRipTime(hours=0, minutes=0, seconds=59),

for syncing video with the .srt file. My question is that when my audio file is longer than 25 seconds, I am not able to sync it with the whole video. Is there any external library or code that I can use or any information about how can I sync the resulting .srt file with the input video?

Thanks in advance.

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

1 participant