EldinZenderink / SubPlayerJS

Subtitle Player for HTML5 video tag made with JavaScript
MIT License
18 stars 11 forks source link

Embedded subtitles #1

Open mauriciogior opened 7 years ago

mauriciogior commented 7 years ago

Will embedded subtitles be available in the future? (mkv container).

EldinZenderink commented 7 years ago

Probably not, unless i create like a decoder in webassembly or something (which im not sure if thats even possible, if it is... its probably out of my league)

mauriciogior commented 7 years ago

Oh, I watched your video (https://www.youtube.com/watch?v=ajwqUHIWbqM) and though it was embedded, correct me if I'm wrong.

Thanks.

EldinZenderink commented 7 years ago

Oh sorry, i interperted your question wrong... yes they are embedded... only the way i did it is horribly inefficient and doesn't allow seeking. I basically load the video file twice, one for the normal html5 video playback, and the other i read peaces of it (to get the subtitle wich seems to be spread across the whole mkv file , which is the reason why i cant retreive a full subtitle file from a partial mkv file and html5 doesnt allow me to look at the raw bitstream while playing) while the first one is playing (those are the requests you see at the right side of the video). Problem is... videos with variable bitrate makes it sometimes go out of sync. Besides that... it puts a huge strain on the server and bandwith (basically > twice the bandwidth when parsing the subtitle) ... and there is a latency issue.... in the video i did all this locally hence it somewhat worked out. Thats why i wouldn't recommend using it. I just noticed that i never mentioned it in the readme xD. I already implemented it in the current version here on github. Instead of the method setSubtitle(url) you need to use parseSubtitle() .Oh well, i hope that i informed you enough with this wall of text x). (Ps... typing on a phone is pain .... ^^)

mauriciogior commented 7 years ago

Thanks! Btw, I'm building an app to watch animes like popcorn time. It currently uses two sources, one with all videos in http protocol with subtitles rendered within the video and other source that loads videos from magnet links, creates a stream from it and plays on a regular html5 video player. The problem is that the source with magnet links has videos with embedded subtitles, non-rendered within the video, so I need to extract the track on the fly while the video is streaming. (ps: the same streaming link, when opened on VLC, the subtitles work just fine).

link: https://github.com/mauriciogior/anime-flix

EldinZenderink commented 7 years ago

Nice, i once had the exact same idea, but i wanted to use xdcc / irc for it :) hence i started this library, i managed to get this far until i lost my motivation: https://youtu.be/ZD6BYFVe8dk . Its really buggy tho ^^. but what you want just isn't quit possible yet :( . Good luck with yours!

EldinZenderink commented 6 years ago

Guess what I have been doing lately ;)

https://youtu.be/mEdKz3Kddho

Im able to parse subtitles from the video file including time stamps, which now enables seeking.

I still need to double request the file from the server (one for the player, one for the subtitleparser), and it's still missing some subtitles, but I am getting closer and closer to make this work ;).

Though, you probably moved on, as I've seen you haven't made a commit to your project since you've posted this.

^^

iptvsmartws commented 6 months ago

does this still working ?