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 subtitles fail to load #1534

Closed
sambartik opened this issue Mar 19, 2022 · 28 comments
Closed

Embedded subtitles fail to load #1534

sambartik opened this issue Mar 19, 2022 · 28 comments
Labels
bug Something isn't working

Comments

@sambartik
Copy link

Describe the bug

I have noticed that all of my embedded subtitles fail to load. When I select them, first I get "Loading subtitles" message and after a while the message disappears and a popup appears: "Failed to load subtitles". External subtitles are working.

I believe this is an error on jellyfin androidtv part, since other types of clients can display the very same subtitles OK. Also, it doesn't matter whether the media is transcoded or direct played, the issue occurs in both cases.

Logs

No response

Application version

0.13.0

Where did you install the app from?

Google Play

Device information

Sony Bravia KD-55XF9005

Android version

9

Jellyfin server version

10.7.7

@sambartik sambartik added the bug Something isn't working label Mar 19, 2022
@dfrincon
Copy link

dfrincon commented Mar 19, 2022

same error from the first beta 0.13 shiledtv 2017 with external and internal .srt sub, jellyfin 10.8 nightly

@nielsvanvelzen
Copy link
Member

Did you experience this issue with the previous version of the app (0.12.3)?

@dfrincon
Copy link

dfrincon commented Mar 19, 2022

Did you experience this issue with the previous version of the app (0.12.3)?

i have installed now 0.12.3 same problem with internal sub, the problem is with ExoPlayer, with libvlc work.

@sambartik
Copy link
Author

Did you experience this issue with the previous version of the app (0.12.3)?

I am not sure, I will try to install 0.12.3 back. Hopefully I will figure out how. Will report back.

@sambartik
Copy link
Author

I have tried 0.12.3, 0.12.2, 0.12.0 and on all of those versions embedded subtitles did not work.

@sambartik
Copy link
Author

Logs that might help:

03-19 23:23:06.821 27790 27790 D jellyfin-apiclient: Adding request to queue: http://192.168.1.2:9876/jellyfin/Videos/7f03fd462cbb8c86637ef915b3ca8330/7f03fd462cbb8c86637ef915b3ca8330/Subtitles/4/0/Stream.JSON?format=json
03-19 23:23:36.862 27790 27790 E jellyfin-apiclient: VolleyError com.android.volley.TimeoutError: null
03-19 23:23:36.862 27790 27790 E jellyfin-apiclient: com.android.volley.TimeoutError
03-19 23:23:36.862 27790 27790 E jellyfin-apiclient: 	at com.android.volley.toolbox.NetworkUtility.shouldRetryException(NetworkUtility.java:162)
03-19 23:23:36.862 27790 27790 E jellyfin-apiclient: 	at com.android.volley.toolbox.BasicNetwork.performRequest(BasicNetwork.java:145)
03-19 23:23:36.862 27790 27790 E jellyfin-apiclient: 	at com.android.volley.NetworkDispatcher.processRequest(NetworkDispatcher.java:132)
03-19 23:23:36.862 27790 27790 E jellyfin-apiclient: 	at com.android.volley.NetworkDispatcher.processRequest(NetworkDispatcher.java:111)
03-19 23:23:36.862 27790 27790 E jellyfin-apiclient: 	at com.android.volley.NetworkDispatcher.run(NetworkDispatcher.java:90)
03-19 23:23:36.864 27790 27790 E PlaybackController: org.jellyfin.apiclient.model.net.HttpException: VolleyError com.android.volley.TimeoutError: 
03-19 23:23:36.864 27790 27790 E PlaybackController: 	at org.jellyfin.apiclient.interaction.VolleyErrorListener.onErrorResponse(VolleyErrorListener.java:25)

@steelersfan7
Copy link

steelersfan7 commented Mar 19, 2022

I get this same issue with a similar error. The jellyfin server logs indicate that ffmpeg extraction complete. When that happens 1-5 minutes(depending on the size of the file) android app will play the subtitles as they should. For some reason exoplayer is reporting to the server that it can't play srt subs(internal or external). There should be no reason to extract the srt files as best I can tell

2022-03-19 19:07:51.807 4423-4423/org.jellyfin.androidtv.debug E/jellyfin-apiclient: VolleyError com.android.volley.TimeoutError: null
com.android.volley.TimeoutError
at com.android.volley.toolbox.NetworkUtility.shouldRetryException(NetworkUtility.java:162)
at com.android.volley.toolbox.BasicNetwork.performRequest(BasicNetwork.java:145)
at com.android.volley.NetworkDispatcher.processRequest(NetworkDispatcher.java:132)
at com.android.volley.NetworkDispatcher.processRequest(NetworkDispatcher.java:111)
at com.android.volley.NetworkDispatcher.run(NetworkDispatcher.java:90)
2022-03-19 19:07:51.808 4423-4423/org.jellyfin.androidtv.debug E/PlaybackController: Error downloading subtitles
org.jellyfin.apiclient.model.net.HttpException: VolleyError com.android.volley.TimeoutError:
at org.jellyfin.apiclient.interaction.VolleyErrorListener.onErrorResponse(VolleyErrorListener.java:25)
at com.android.volley.Request.deliverError(Request.java:648)
at com.android.volley.ExecutorDelivery$ResponseDeliveryRunnable.run(ExecutorDelivery.java:104)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7356)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
Caused by: com.android.volley.TimeoutError
at com.android.volley.toolbox.NetworkUtility.shouldRetryException(NetworkUtility.java:162)
at com.android.volley.toolbox.BasicNetwork.performRequest(BasicNetwork.java:145)
at com.android.volley.NetworkDispatcher.processRequest(NetworkDispatcher.java:132)
at com.android.volley.NetworkDispatcher.processRequest(NetworkDispatcher.java:111)
at com.android.volley.NetworkDispatcher.run(NetworkDispatcher.java:90)

@zilexa
Copy link

zilexa commented Mar 19, 2022

After updating Jellyfin server then rebooting AndroidTV, the issue was gone but I only tested 1 episode.

@steelersfan7
Copy link

steelersfan7 commented Mar 19, 2022

Yeah, but before you did those things, did you try and use the subtitle? Once you use a subtitle even once, it will load fine. Also, this only affects subrips, srt external. PGS etc load fine

@sambartik
Copy link
Author

After doing some more poking myself, I have found that the error was due to a timeout to jellyfin API endpoint. The request took so long because on the jellyfin backend's side the embedded subtitles were being extracted from the mkv file itself by ffmpeg. The extracted subtitle file was then saved to /config/data/data/subtitles folder.

After the ffmpeg extraction was successfully completed, I had to manually switch to another subtitle and back to get it to display.

OK.

My questions are:

  • Is the "Allow extraction on the fly" respected in my case? Despite having it disabled, the embedded subtitles were extracted via ffmpeg when I requested them in jellyfin android tv app.
  • I had number of cases, where these extracted subtitles were completely blank. Maybe an ffmpeg error occured? Does closing the player in android tv app in the middle of subtitles extraction on jellyfin backend somehow trigger an ffmpeg error and thus results in a blank extracted subtitle?

@steelersfan7
Copy link

This is my findings too. I think exoplayer should be fully capable of playing subrips, SRT files natively, with no transcoding.

I understand that option only works for like one client, Kodi maybe?
I think the subtitles are extracted server side. I can't imagine the android tv app being reset would cause it to be blank

@sambartik
Copy link
Author

I can't imagine the android tv app being reset would cause it to be blank

I meant it like this. The ATV client sends to the server that it has exited the player and stopped the stream to the backend. And that would result in backend killing the ffmpeg extraction process which would left blank file. This is pure speculation though.

@steelersfan7
Copy link

Yeah, sounds like it might be a seperate issue, or a sympton. In theory, it shouldnt be extracting anyway.

@nielsvanvelzen
Copy link
Member

@steelersfan7
Copy link

Seems to still not work for me on the simulator

@sambartik
Copy link
Author

Did not work for me as well.

@nielsvanvelzen
Copy link
Member

Looking further in the code I found this part:

case Embed:
if (!mVideoManager.isNativeMode()) {
if (mFragment != null)
mFragment.addManualSubtitles(null); // in case these were on
if (!mVideoManager.setSubtitleTrack(index, getCurrentlyPlayingItem().getMediaStreams())) {
// error selecting internal subs
if (mFragment != null)
Utils.showToast(mFragment.getContext(), mFragment.getString(R.string.msg_unable_load_subs));
}
break;
}
// not using vlc - fall through to external handling

This makes me believe we don't support embedded subtitles at all and the app will always request the server to extract them when ExoPlayer is used. LibVLC should support embedded subtitles without extraction already (although the linked PR might be required for it to actually work).

@steelersfan7
Copy link

But in theory, exoplayer should be able to support embedded subs right?

@sambartik
Copy link
Author

Is it just me or LibVLC still requires jellyfin to extract embedded subtitles? I have tried playing media on the artefact version linked above and made no difference. With the exception that for some reason LibVLC required to transcode audio as well and Exoplayer did not.

@nielsvanvelzen
Copy link
Member

But in theory, exoplayer should be able to support embedded subs right?

Yes but it's not implemented in our code

Is it just me or LibVLC still requires jellyfin to extract embedded subtitles?

I pushed a new change to the linked pull request when I posted my previous message, the newer artifact should work with LibVLC. (https://github.com/jellyfin/jellyfin-androidtv/suites/5729875269/artifacts/189681637)

@steelersfan7
Copy link

But in theory, exoplayer should be able to support embedded subs right?

Yes but it's not implemented in our code

Something to look forward to in the new playback rewrite, eventually?

@nielsvanvelzen
Copy link
Member

Something to look forward to in the new playback rewrite, eventually?

Yeah I'll definitely implement it in the rewrite.

@zilexa
Copy link

zilexa commented Mar 23, 2022

After updating Jellyfin server then rebooting AndroidTV, the issue (SRT subs) was gone but I only tested 1 episode.

Yeah, but before you did those things, did you try and use the subtitle? Once you use a subtitle even once, it will load fine. Also, this only affects subrips, srt external. PGS etc load fine

I tested with never played content instead of stuff I had already tested.
After updating Server and rebooting AndroidTV, SRT subtitles for new content no longer fail but it does take quite a long time for them to load. I often have to rewind or restart the content because I missed the first 20 sec --> This seems to indicate Jellyfin is trying to do something with the SRT file instead of just loading them?

This is on a ShieldTV Pro 2019.

@quaintdev
Copy link

What I had observed was when I switch back default player from ExoPlayer to Auto the embedded subtitles work.

@giacomofabbri
Copy link

I have the same error on my Fire TV2 using both ExoPlayer and Auto, please I’m desperate to use always Jellyfin and not Plex, thanks

@quaintdev
Copy link

quaintdev commented Apr 14, 2022

The issue is I think when selected "Auto" as playback option it uses libVlc which does not show option to Zoom but it loads subtitles. On other hand exo player has option to zoom but it cannot load subtitles. So either I have to watch video with black strips at top/bottom or I can zoom but not have subtitles!

I should be able to zoom video and view subtitle at same time.

@axel-lebourhis
Copy link

Hey all, juste wanted to report I have the same issue on my shield, app version is the latest. I'm a new user so I don't have experience with previous ones.
I'm not having the issue with Plex, so it's mot the media file.

@nielsvanvelzen
Copy link
Member

Closing as duplicate of #145.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

8 participants