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

Subtitles are misaligned after cutting #21

Open
faissaloo opened this issue Feb 13, 2021 · 3 comments
Open

Subtitles are misaligned after cutting #21

faissaloo opened this issue Feb 13, 2021 · 3 comments

Comments

@faissaloo
Copy link
Owner

faissaloo commented Feb 13, 2021

After cutting a video subtitles end up misaligned, we'll need to extract them like so: https://superuser.com/a/927507/889417 then figure out how to cut them and add them to the new video

Example subtitle file, downloaded via youtube-dl --all-subs --skip-download https://www.youtube.com/watch\?v\=Ye8mB6VsUHw

WEBVTT
Kind: captions
Language: en

00:00:00.832 --> 00:00:04.480
COOKIE MONSTER: Now, what starts
with the letter C?

00:00:04.480 --> 00:00:08.230
Cookie starts with C. Let's
think of other things that
@pukkandan
Copy link
Contributor

This may be quite difficult to implement fully since the youtube-dl supports embedding of multiple subtitle formats (srt, vtt, ttml, srv etc)

@faissaloo
Copy link
Owner Author

faissaloo commented Feb 14, 2021

Yeah, either I'll have to write parsers for each format or see if I can get youtube-dl to force them into a single format.
Based on what I've been thinking regarding #22 we probably shouldn't need to be parsing subtitles directly and it seems like ffmpeg can cut subs? https://stackoverflow.com/questions/21554541/cut-parts-of-subtitle-file-using-ffmpeg

@pukkandan
Copy link
Contributor

I can get youtube-dl to force them into a single format.

Yes, you can. There is --convert-subs. But the user might not want to.

Also, something I forgot to mention is my previous comment: the video may also contain multiple subs; each possibly in a different format.

we probably shouldn't need to be parsing subtitles directly and it seems like ffmpeg can cut subs? https://stackoverflow.com/questions/21554541/cut-parts-of-subtitle-file-using-ffmpeg

huh, interesting. Though that thread doesn't mention about more complex filters, it seems it might be worth looking into. That would help avoid a lot of headaches of trying to implement a full subtitle parser

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