arianneorpilla / jidoujisho

A full-featured immersion language learning suite for mobile.
GNU General Public License v3.0
962 stars 60 forks source link

Subtitles not passed when watching from media server #91

Closed jacktheripper19 closed 1 year ago

jacktheripper19 commented 2 years ago

Hello, I'm trying to watch with subtitles from a Jellyfin media server. The video is playing correctly but subtitles are not included in the built in video player.

I tried using the app as an external player from Jellyfin android app. I also tried using a direct network stream link.

I tried playing episodes having srt or ass sub files on the server. I also tried with mkv videos that already include subs in the container.

VLC works fine and doesn't have this issue for loading subs from the media server.

Thanks

arianneorpilla commented 2 years ago

The app has Plex and other network players support but subtitles not being passed to the app is a limitation of streaming. jidoujisho requires the full subtitle file to be able to deliver a full transcript of the video, and streamed videos are delivered in such a way that subtitle data is delivered on demand as needed, and not all at once.

It does not rely on the video file on runtime, but at startup where it attempts to get the entire subtitle data from the video. This is impossible when streaming, hence the limitation. This is something that I want to get to work, but I will need a way to get subtitle data from my video player dependencies as the video is playing, which they currently do not have.

I recommend hosting your own subtitles on your local device while streaming from local network while I cannot figure this out.

jacktheripper19 commented 2 years ago

Thank you for the recommendation. When reading that

jidoujisho will take video and audio formats as supported by VLC. Subtitles may be embedded within the video being played and selected during playback.

I thought that it uses dependencies from VLC player. so since VLC is working fine for mkv containers with subtitles, this should work as well. Maybe their implementation in https://github.com/kazemihabib/vlc-android/blob/0e3e6b2552e6d780bd7d578a212e53d1d9085995/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java#L2825 would give an idea of how it's done while using it as an external player.

jacktheripper19 commented 2 years ago

https://github.com/mpv-android/mpv-android/issues/61 This issue from another android video player could also be useful.

xrishox commented 2 years ago

i know that jellyfin mpv shim and plex mpv shim used to have similar limitations and issues with streaming subtitles over the network but found a way to solve them. obvioulsy that project is using mpv on top of being a desktop project, but i wonder if whatever they discovered that allowed them to solve this issue could be ported over to a project like this.

arianneorpilla commented 1 year ago

As an update on this issue as I'm still very much interested in getting this to work, it doesn't seem like Plex passes any useful parameters related to the subtitles in the intent triggered when the app is used as an external player.

To be clear, the app gets ahold of the subtitles by running ffmpeg on a local video file and getting its subtitles. It doesn't interact with VLC, which doesn't appear to have any useful functions to get current subtitle information from the player (this appears to be a well requested feature that doesn't get much attention if you look around enough forums).

This is why, even if subtitles are in the container, subtitles do not work on network media as I cannot usefully run ffmpeg on a file that is essentially being streamed (that would require all the data to be downloaded so that the entire subtitle file I need is sourced).

So, unless the VLC package I use gives me a way to give current subtitle information (which is very unlikely), I can never get subtitles from a streamed video.

Supposedly, there are other services that do pass subtitle information in their intent. I haven't tried Jellyfin yet but if they include a URL to a file I can download, I can probably work with that. I'm a Plex user so I have just never tried but I will see what I can do.

facferreira commented 1 year ago

Checking the code of Jellyfin it sends the subtitles array as intent extras (as well as the selected subtitle inside Jellyfin, if applicable): https://github.com/jellyfin/jellyfin-android/blob/master/app/src/main/java/org/jellyfin/mobile/bridge/ExternalPlayer.kt#L193

arianneorpilla commented 1 year ago

I have added support for passing subtitles for when using Jellyfin as an external player.

This build includes a work in progress 2.4.0 (only supporting Japanese at the moment) that includes an overhaul of the dictionary system and should be much, much faster than the current system, supports wildcard searching (? or ? for one character, * or ※ (こめ) for zero to any characters) but will require a fresh installation. You can get the build here.

Feel free to reach out if there are any issues.

arianneorpilla commented 1 year ago

Changes for this issue have been included in the 2.4 preview.

arianneorpilla commented 1 year ago

I just want to mention in my testing that external subtitles for a video hosted by Jellyfin do work: embedded subtitles will need a bit more intervention. Luckily, Jellyfin has a plugin for automatically extracting embedded subtitles from videos. Not that embedded Japanese subtitles are common for anime anyway.

You can install it via the Plugins tab under Jellyfin settings, and then enable the Scheduled Task for it and give it an interval to run. Just thought I would document for people that are looking to setup a fault-free setup with my app and Jellyfin.

arianneorpilla commented 1 year ago

2.4 is out of preview so I am closing this issue.

Kellenok commented 10 months ago

hi is it possible to add support for the streaming of subtitles from stremio?

weeebdev commented 10 months ago

hi is it possible to add support for the streaming of subtitles from stremio?

Jeez. Same question. Should I open another issue? @lrorpilla

weeebdev commented 2 months ago

hi is it possible to add support for the streaming of subtitles from stremio?

I opened an issue https://github.com/arianneorpilla/jidoujisho/issues/393