jellyfin / jellyfin-android

Android Client for Jellyfin
https://jellyfin.org
GNU General Public License v2.0
1.44k stars 239 forks source link

Exoplayer loading the wrong subtitle #944

Open zx900930 opened 1 year ago

zx900930 commented 1 year ago

Describe the bug

I'm facing this subtitle loading bug.

Subtitle settings: image

The server correctly detect the chinese subtitles and use it to play the media image

As the logs shows below, the server send the file without subtitle index. [2023-01-01 20:58:32.617 +00:00] [INF] [45] Jellyfin.Api.Helpers.MediaInfoHelper: StreamBuilder.BuildVideoItem( Profile="Jellyfin Android", Path="/media/series/Romantic Killer/Season 1/Romantic Killer - S01E09 - Ginger Ale Is a Force Majeure WEBRip-1080p.mkv", AudioStreamIndex=null, SubtitleStreamIndex=null ) => ( PlayMethod=DirectPlay, TranscodeReason=0 ) "media:/videos/2c8882d8-0158-68c7-6d25-6e0ac6b4c484/stream.mkv?MediaSourceId=2c8882d8015868c76d256e0ac6b4c484&Static=true&VideoCodec=hevc&AudioCodec=aac&AudioStreamIndex=3&api_key=<token>&Tag=8419c1b4b8e397a4fe5412e504ea7d35"

Bug: Exoplayer is playing the english subtitle despite the UI shows its a chinese subtitle (When I switched to english subtitle it displays chinese subtitle instead, the subtitle index was wrong). image

Media Info of the file:

Romantic Killer - S01E10 - Other Way Around, Dummy WEBRip-1080p
Container: mkv
Path: /media/series/Romantic Killer/Season 1/Romantic Killer - S01E10 - Other Way Around, Dummy WEBRip-1080p.mkv
Size: 433 MB

Video
Title: 1080p HEVC SDR
Codec: HEVC
Profile: Main 10
Level: 120
Resolution: 1920x1080
Aspect ratio: 16:9
Interlaced: No
Framerate: 23.976025
Bitrate: 2320 kbps
Bit depth: 10 bit
Video range: SDR
Video range type: SDR
Color space: bt709
Pixel format: yuv420p10le
Ref frames: 1

Audio
Title: Japanese - AAC - 5.1 - Default
Language: jpn
Codec: AAC
Profile: LC
Layout: 5.1
Channels: 6 ch
Bitrate: 207 kbps
Sample rate: 48000 Hz
Default: Yes
Forced: No
External: No

Subtitle
Title: 简体 - Chi - SUBRIP
Language: chi
Codec: SUBRIP
Default: No
Forced: No
External: No

Subtitle
Title: 繁体 - Chi - SUBRIP
Language: chi
Codec: SUBRIP
Default: No
Forced: No
External: No

Subtitle
Title: English - SUBRIP - External
Language: eng
Codec: SUBRIP
Default: No
Forced: No
External: Yes

Subtitle
Title: Fre - SUBRIP - External
Language: fre
Codec: SUBRIP
Default: No
Forced: No
External: Yes

The Web UI and desktop jellyfin media player and the webplayer inside jellyfin android client doesn't have this bug.

For comparison: Jellyfin media player or Web UI, the subtitle index was correct. image And in the log you can clearly see the SubtitleStreamIndex=4 is there [2023-01-01 21:17:10.980 +00:00] [INF] [8] Jellyfin.Api.Helpers.MediaInfoHelper: StreamBuilder.BuildVideoItem( Profile="Jellyfin Media Player", Path="/media/series/Romantic Killer/Season 1/Romantic Killer - S01E09 - Ginger Ale Is a Force Majeure WEBRip-1080p.mkv", AudioStreamIndex=3, SubtitleStreamIndex=4 ) => ( PlayMethod=DirectPlay, TranscodeReason=0 ) "media:/videos/2c8882d8-0158-68c7-6d25-6e0ac6b4c484/stream.mkv?MediaSourceId=2c8882d8015868c76d256e0ac6b4c484&Static=true&VideoCodec=hevc&AudioCodec=aac&AudioStreamIndex=3&SubtitleStreamIndex=4&api_key=<token>&SubtitleMethod=Embed&Tag=8419c1b4b8e397a4fe5412e504ea7d35"

Application version

2.4.4

Where did you install the app from?

Google Play

Device information

Lenovo XiaoXin Pad Pro 2021

Android version

Android 11 OEM

Jellyfin server version

10.8.8

Which video player implementations does this bug apply to?

Maxr1998 commented 1 year ago

Could you try the 2.5.0-beta.1 please? We released that update the other day, it should contain a fix for your issue.

zx900930 commented 1 year ago

Could you try the 2.5.0-beta.1 please? We released that update the other day, it should contain a fix for your issue.

Still the same bug with 2.5.0-beta 1, and this bug only occurs when using exoplayer since the web player is working correctly and external players doesnt auto load subs anyway.

zikziko commented 1 year ago

I'm currently facing the same issue. 2.5.0-beta 1 does not seem to resolve it. It seems like the player selects the subtitles next in line of the subtitles you select.

Me0wzz commented 1 year ago

I can also confirm that ExoPlayer loads other subtitle that I didn't select. When using Web based player, It loads subtitle flawlessly. +) using External player like VLC also shows worng subtitles Server: 10.8.9 (docker) App: 2.5.0-beta1

mskpluk commented 1 year ago

Not resolved in 2.5.0-beta2

jellyfin-bot commented 1 year ago

This issue has gone 120 days without comment. To avoid abandoned issues, it will be closed in 21 days if there are no new comments.

If you're the original submitter of this issue, please comment confirming if this issue still affects you in the latest release or master branch, or close the issue if it has been fixed. If you're another user also affected by this bug, please comment confirming so. Either action will remove the stale label.

This bot exists to prevent issues from becoming stale and forgotten. Jellyfin is always moving forward, and bugs are often fixed as side effects of other changes. We therefore ask that bug report authors remain vigilant about their issues to ensure they are closed if fixed, or re-confirmed - perhaps with fresh logs or reproduction examples - regularly. If you have any questions you can reach us on Matrix or Social Media.

mskpluk commented 1 year ago

Works as it should in 2.5.2

jellyfin-bot commented 9 months ago

This issue has gone 120 days without comment. To avoid abandoned issues, it will be closed in 21 days if there are no new comments.

If you're the original submitter of this issue, please comment confirming if this issue still affects you in the latest release or master branch, or close the issue if it has been fixed. If you're another user also affected by this bug, please comment confirming so. Either action will remove the stale label.

This bot exists to prevent issues from becoming stale and forgotten. Jellyfin is always moving forward, and bugs are often fixed as side effects of other changes. We therefore ask that bug report authors remain vigilant about their issues to ensure they are closed if fixed, or re-confirmed - perhaps with fresh logs or reproduction examples - regularly. If you have any questions you can reach us on Matrix or Social Media.

gkswngh05 commented 3 months ago

The issue persists in 2.6.1 and latest git.

It appears that the bug happens when video and audio track come after subtitle tracks (e.g. Subtitle tracks are 0-4, video and audio tracks are 5,6). A temporary solution is remapping video and audio to first tracks.

My hypothesis is that ExoPlayer is remapping video and audio to the first tracks. For example, if there are 1 video track and 1 audio track, subtitle index is shifted by 2. (e.g. subtitles on track 0 became 2, track 1 became 3, etc.) However, Jellyfin selects subtitles based on the original track index. So, selecting subtitle track 5 actually corresponds to track 3 in the original file.