Swiftfin icon indicating copy to clipboard operation
Swiftfin copied to clipboard

External subtitles are not displayed

Open RayYoLin opened this issue 3 years ago • 24 comments
trafficstars

Describe the bug

All external subtitles are not displayed.

No matter the format of external subtitles is srt or ass can not be displayed.

Embedded subtitles can be displayed.

The video formats tested are all mkv.

Application version

1.0.0(74)

Where did you install the app from?

TestFlight

Device information

iPhone 12 Pro

OS version

IOS 15.4.1

Jellyfin server version

10.8.0(docker nyanmisaka/jellyfin)

RayYoLin avatar Apr 25 '22 17:04 RayYoLin

Thank you for the issue. By "external subtitles" do you mean subtitles that are downloaded and are an explicit file in your library?

LePips avatar Apr 25 '22 17:04 LePips

Thank you for the issue. By "external subtitles" do you mean subtitles that are downloaded and are an explicit file in your library?

Yes. These external subtitles can be displayed by desktop Chrome or Jellyfin Mobile (iOS) 1.4.1 (5.4.1.0) or Android-TV v0.13.3.

RayYoLin avatar Apr 25 '22 18:04 RayYoLin

Any update on this issue?

khoint0210 avatar May 11 '22 03:05 khoint0210

I looked at this a little bit yesterday. The same subtitles on the same media in 10.7.7 and 10.8 had the same URL. However, in 10.8, I received an HTTP 400 error when loading.

I think I need to compare it with other Jellyfin clients.

PangMo5 avatar Jun 14 '22 00:06 PangMo5

Infuse 7 also have the same issue https://community.firecore.com/t/update-for-jellyfin-10-8-0/36956 https://community.firecore.com/t/external-jellyfin-subtitles-not-loading/37776

MrMC and Jellyfin Mobile work just fine

khoint0210 avatar Jun 14 '22 07:06 khoint0210

Summary from the PR:

There is something incorrect in the server that incorrectly labels the subtitle format on the media stream, not with the delivery URL in the app. However I do not see this error on my development server which is 10.8.0.

For proof that it is a server issue, I currently have srt subtitles that are incorrectly being labeled as subrip on my home server: Screen Shot 2022-06-17 at 12 45 51 PM Screen Shot 2022-06-17 at 12 51 03 PM

and with my development branch on master they are labeled correctly: Screen Shot 2022-06-17 at 12 53 49 PM

I will have to find the logs and file a server issue.

Edit: this happens to me as well on my development after I add new media with external subtitles.

LePips avatar Jun 17 '22 18:06 LePips

Can you test if it still happens on a current build of the 10.8 release branch before filing the issue?

Shadowghost avatar Jun 17 '22 19:06 Shadowghost

This does still occur on the branch release-10.8.z

LePips avatar Jun 17 '22 19:06 LePips

I think both SubRip and SRT and valid, SRT is the file extension of SubRip subtitles.

format_name=srt equals to codec_name=subrip in ffprobe.

External ASS subtitles are not displayed too.

nyanmisaka avatar Jun 17 '22 19:06 nyanmisaka

@nyanmisaka Would you be able to provide a screenshot of media with ass external subtitles like I have to see if they're being mislabeled?

You can access that in your media -> click the three vertical dots -> Edit subtitles

LePips avatar Jun 17 '22 19:06 LePips

For whatever reason I can't upload pictures but I just checked it on a fresh library: external ASS subs are listed as ASS on the current release branch.

And I'm not sure if this really is a server bug because technically SubRip is the correct codec name - srt is just the extension. Edit: The bad delivery URL is a server bug but the codec name isn't.

Shadowghost avatar Jun 17 '22 19:06 Shadowghost

image

External ASS subtitle works just fine only if I remuxed them into the video.

nyanmisaka avatar Jun 17 '22 19:06 nyanmisaka

@Shadowghost Sorry, you are correct in the codec specification. I understand now.

LePips avatar Jun 17 '22 19:06 LePips

https://github.com/jellyfin/Swiftfin/blob/6cab041c42cb0b1cdd4d9445f44c7b7b3416a1f3/Shared/Objects/DeviceProfileBuilder.swift#L140 explicitly declares subrip which is then just appended to the filename in https://github.com/jellyfin/jellyfin/blob/b36543275f8e1c380f5c247a04a48d5d96eb5836/MediaBrowser.Model/Dlna/StreamInfo.cs#L910

Shadowghost avatar Jun 17 '22 19:06 Shadowghost

Let's keep all convo about this in Matrix from now on

LePips avatar Jun 17 '22 20:06 LePips

The original issue will be fixed by https://github.com/jellyfin/jellyfin/pull/7960, however I have run into an issue where the stream indices differ and can throw the player into an infinite loop and still not show external subtitles. I'll have to test some more to see if this issue is just to my specific movie, whether the streams differ on new scans, or whatever

LePips avatar Jun 18 '22 00:06 LePips

There were changes in 10.8 in regards to stream indices: external subtitles and audio have lower stream indices than the ones from the file itself, in 10.7 external streams were appended to already existing ones. You most likely need to subtract the amount of external streams from the StreamIndex to get the StreamIndex the stream has within the media file.

Shadowghost avatar Jun 18 '22 04:06 Shadowghost

Thanks for the insight, changes a lot of debugging.

LePips avatar Jun 18 '22 04:06 LePips

I'm seeing on the server side requests with url encoded api_key param, for example,

GET /Videos/<hash>/Subtitles/1/0/Stream.subrip%3Fapi_key=<token>

and subsequently triggering the exception,

 System.ArgumentException: Unsupported format: subrip?api_key=<token>
   at MediaBrowser.MediaEncoding.Subtitles.SubtitleEncoder.GetWriter(String format)
   at MediaBrowser.MediaEncoding.Subtitles.SubtitleEncoder.ConvertSubtitles(Stream stream, String inputFormat, String outputFormat, Int64 startTimeTicks, Int64 endTimeTicks, Boolean preserveOriginalTimestamps, CancellationToken cancellationToken)
   ...

It looks like this extra url encode is another problem preventing the external subtitle from showing. I'm running jellyfin server v10.8.1 which understands the subrip format.

luoqi-git avatar Jul 03 '22 04:07 luoqi-git

I'm seeing on the server side requests with url encoded api_key param, for example, ...

Thank you for the analysis. I'll take care of it quickly.

PangMo5 avatar Jul 03 '22 05:07 PangMo5

Im seeing this on the ATV client. External SRT downloaded via the open subtitles and is stored alongside the file, the client shows the subtitle is checked but nothing is showing on screen. I assume this happens on iOS apps as the app is universal.

eximo84 avatar Aug 01 '22 19:08 eximo84

We are not related to the ATV client. The only thing we need to fix to close this issue is the stream index changes.

LePips avatar Aug 01 '22 19:08 LePips

Oh, which github repo is related to the Apple TV app then? Isnt SwiftFin a universal iOS app?

eximo84 avatar Aug 01 '22 19:08 eximo84

I apologize, I got mixed up. ATV has typically meant Android TV.

LePips avatar Aug 01 '22 19:08 LePips

When will #533 be released?

josefssonemil avatar Sep 15 '22 16:09 josefssonemil

This was released in the latest iOS release, tvOS will get it in its next release.

LePips avatar Sep 15 '22 16:09 LePips

This was released in the latest iOS release, tvOS will get it in its next release.

Alright! Any status for the tvOS release?

josefssonemil avatar Sep 15 '22 16:09 josefssonemil

It will be relatively soon

LePips avatar Sep 15 '22 16:09 LePips