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

embedded mkv subtitles #79

Closed
Guizzu opened this issue Oct 28, 2020 · 6 comments
Closed

embedded mkv subtitles #79

Guizzu opened this issue Oct 28, 2020 · 6 comments

Comments

@Guizzu
Copy link

Guizzu commented Oct 28, 2020

Hi, would it be possible to use a .ass that is embedded in a matroska video file?

AFAIK .mkv files works just like a .zip, with audio, video, subtitles and related files inside of it, wouldn't it be possible for the WASM to open and read the subtitle inside of the mkv?

@Yay295
Copy link

Yay295 commented Oct 28, 2020

Technically yes, with things like Emscripten you can turn almost any standalone program into a web application, but it's not as simple as just unzipping the video container. The subtitle lines are actually interleaved throughout the file, so you would have to completely load the video file to get all of the subtitles. This sounds more like something that could be done with a separate program, and then once you've gotten just the subtitle file using that program you could feed it to this library like normal.

@Guizzu
Copy link
Author

Guizzu commented Oct 28, 2020

Got it, probably not worth it then, since the whole file has to be read and that would take a long time over network.
I tought it would be as simple as this project https://github.com/qgustavor/patcher/blob/master/main.js which reads file hashes and can be used to write patched subtitles inside an mkv file... But I think it doesn't separate the subtitle from the mkv then.

@qgustavor
Copy link
Contributor

@Guizzoni Instead of using the patcher try using this: https://github.com/qgustavor/mkv-extract/

@Guizzu
Copy link
Author

Guizzu commented Nov 9, 2020

Thanks @qgustavor, but I think that it would probably need the file fully downloaded before we could extract the .ass and use it within the web-player

@qgustavor
Copy link
Contributor

It works using file streaming but currently needs a continuous stream. Maybe you can modify this to work with a seek-able stream (which is normal for a web player). By the way you will need to load the header of the file as fonts and subtitle styles are stored there.

@TheOneric
Copy link
Member

JSO is only a subtitle renderer which can be integrated into players, not a full media player itself. As such it never sees the whole media file, only the subtitle data. Any mkv parsing would need to be implemented in a player with the ability to forward subtitle data to JSO.
Note that even if a player implements MKV parsing though, it currently would only work when the subtitle data is fully available at once. This working with streamed packets depends on #89.

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

No branches or pull requests

4 participants