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

Can't select subtitles, it jumps back to none #1256

Open
ikheetjeff opened this issue Oct 6, 2024 · 23 comments · May be fixed by #1445
Open

Can't select subtitles, it jumps back to none #1256

ikheetjeff opened this issue Oct 6, 2024 · 23 comments · May be fixed by #1445
Labels
bug Something isn't working

Comments

@ikheetjeff
Copy link

Describe the bug

Thank you all for this fantastic app.

When I click on a subtitle, I expect it to load. However, that doesn’t happen: it switches back to "none" and doesn’t display any subtitles. This occurs with all SUBRIP languages in this video. However, it doesn’t happen with all series/movies. I haven’t been able to find a reason why it doesn’t work with this file but does with other films/series.

I’ve tried the following:

  • Reinstalled the app
  • Created a new folder + file name without metadata
  • Used a different subtitle file in the same language
  • Used a different subtitle file in another language
  • The file also had PGS subtitles, which I removed using MKVToolNix and loaded only the SUBRIP: still didn’t work.
  • Converted the video to H264 using Handbrake. (idk why but yeah i wanted to try everything before making a issue here)

When I installed an earlier TestFlight build (1.2 (3)), the problem was resolved. The issue is also not present in the App Store version.

I suspect it is related to this PR: #1219
Hopefully, @cebrusfs, you can take a look at this due to your previous commit. My apologies if this tag is not appreciated.

This video shows the bug: (TestFlight 1.2 (4))

subtitlesnotwork.2.mp4

This is how it should work: (TestFlight 1.2 (3) / App Store version)

subtitleswork.2.mp4

Original media file (added the SUBRIP manualy in jellyfin)

General
Complete name                            : The.Walking.Dead.Daryl.Dixon.S01E02.Alouette.EAC3.5.1.1080p.Bluray.x265-NLSubs-SJK.mkv
Format                                   : Matroska
Format version                           : Version 4
File size                                : 1.08 GiB
Duration                                 : 1 h 0 min
Overall bit rate                         : 2 559 kb/s
Frame rate                               : 23.976 FPS
Encoded date                             : 2024-02-24 19:18:12 UTC
Writing application                      : HandBrake 1.6.1 2023012300
Writing library                          : Lavf59.27.100
ErrorDetectionType                       : Per level 1

Video
ID                                       : 1
Format                                   : HEVC
Format/Info                              : High Efficiency Video Coding
Format profile                           : Main@L4@Main
Codec ID                                 : V_MPEGH/ISO/HEVC
Duration                                 : 1 h 0 min
Bit rate                                 : 1 868 kb/s
Width                                    : 1 920 pixels
Height                                   : 960 pixels
Display aspect ratio                     : 2.000
Frame rate mode                          : Constant
Frame rate                               : 23.976 (24000/1001) FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0 (Type 0)
Bit depth                                : 8 bits
Bits/(Pixel*Frame)                       : 0.042
Stream size                              : 804 MiB (73%)
Writing library                          : x265 3.5+1-f0c1022b6:[Windows][GCC 10.2.0][64 bit] 8bit+10bit+12bit
Encoding settings                        : cpuid=1111039 / frame-threads=5 / numa-pools=32 / wpp / no-pmode / no-pme / no-psnr / no-ssim / log-level=2 / input-csp=1 / input-res=1920x960 / interlace=0 / total-frames=0 / level-idc=0 / high-tier=1 / uhd-bd=0 / ref=4 / no-allow-non-conformance / no-repeat-headers / annexb / no-aud / no-eob / no-eos / no-hrd / info / hash=0 / no-temporal-layers / open-gop / min-keyint=24 / keyint=240 / gop-lookahead=0 / bframes=4 / b-adapt=2 / b-pyramid / bframe-bias=0 / rc-lookahead=25 / lookahead-slices=4 / scenecut=40 / no-hist-scenecut / radl=0 / no-splice / no-intra-refresh / ctu=64 / min-cu-size=8 / rect / no-amp / max-tu-size=32 / tu-inter-depth=1 / tu-intra-depth=1 / limit-tu=0 / rdoq-level=2 / dynamic-rd=0.00 / no-ssim-rd / signhide / no-tskip / nr-intra=0 / nr-inter=0 / no-constrained-intra / strong-intra-smoothing / max-merge=3 / limit-refs=3 / limit-modes / me=3 / subme=3 / merange=57 / temporal-mvp / no-frame-dup / no-hme / weightp / no-weightb / no-analyze-src-pics / deblock=0:0 / sao / no-sao-non-deblock / rd=4 / selective-sao=4 / no-early-skip / rskip / no-fast-intra / no-tskip-fast / no-cu-lossless / no-b-intra / no-splitrd-skip / rdpenalty=0 / psy-rd=2.00 / psy-rdoq=1.00 / no-rd-refine / no-lossless / cbqpoffs=0 / crqpoffs=0 / rc=crf / crf=23.0 / qcomp=0.60 / qpstep=4 / stats-write=0 / stats-read=0 / ipratio=1.40 / pbratio=1.30 / aq-mode=2 / aq-strength=1.00 / cutree / zone-count=0 / no-strict-cbr / qg-size=32 / no-rc-grain / qpmax=69 / qpmin=0 / no-const-vbv / sar=1 / overscan=0 / videoformat=5 / range=0 / colorprim=1 / transfer=1 / colormatrix=1 / chromaloc=1 / chromaloc-top=0 / chromaloc-bottom=0 / display-window=0 / cll=0,0 / min-luma=0 / max-luma=255 / log2-max-poc-lsb=8 / vui-timing-info / vui-hrd-info / slices=1 / no-opt-qp-pps / no-opt-ref-list-length-pps / no-multi-pass-opt-rps / scenecut-bias=0.05 / no-opt-cu-delta-qp / no-aq-motion / no-sbrc / no-hdr10 / no-hdr10-opt / no-dhdr10-opt / no-idr-recovery-sei / analysis-reuse-level=0 / analysis-save-reuse-level=0 / analysis-load-reuse-level=0 / scale-factor=0 / refine-intra=0 / refine-inter=0 / refine-mv=1 / refine-ctu-distortion=0 / no-limit-sao / ctu-info=0 / no-lowpass-dct / refine-analysis-type=0 / copy-pic=1 / max-ausize-factor=1.0 / no-dynamic-refine / no-single-sei / no-hevc-aq / no-svt / no-field / qp-adaptation-range=1.00 / scenecut-aware-qp=0conformance-window-offsets / right=0 / bottom=0 / decoder-max-rate=0 / no-vbv-live-multi-pass / no-mcstf
Default                                  : Yes
Forced                                   : No
Color range                              : Limited
Color primaries                          : BT.709
Transfer characteristics                 : BT.709
Matrix coefficients                      : BT.709

Audio
ID                                       : 2
Format                                   : E-AC-3
Format/Info                              : Enhanced AC-3
Commercial name                          : Dolby Digital Plus
Codec ID                                 : A_EAC3
Duration                                 : 1 h 0 min
Bit rate mode                            : Constant
Bit rate                                 : 640 kb/s
Channel(s)                               : 6 channels
Channel layout                           : L R C LFE Ls Rs
Sampling rate                            : 48.0 kHz
Frame rate                               : 31.250 FPS (1536 SPF)
Compression mode                         : Lossy
Delay relative to video                  : -5 ms
Stream size                              : 275 MiB (25%)
Language                                 : English
Service kind                             : Complete Main
Default                                  : Yes
Forced                                   : No
Dialog Normalization                     : -31 dB
dialnorm_Average                         : -31 dB
dialnorm_Minimum                         : -31 dB
dialnorm_Maximum                         : -31 dB

Text #1
ID                                       : 3
Format                                   : PGS
Codec ID                                 : S_HDMV/PGS
Codec ID/Info                            : Picture based subtitle format used on BDs/HD-DVDs
Duration                                 : 57 min 16 s
Title                                    : English (Forced)
Language                                 : English
Default                                  : No
Forced                                   : No

Text #2
ID                                       : 4
Format                                   : PGS
Codec ID                                 : S_HDMV/PGS
Codec ID/Info                            : Picture based subtitle format used on BDs/HD-DVDs
Duration                                 : 59 min 10 s
Title                                    : English (SDH)
Language                                 : English
Default                                  : No
Forced                                   : No

Text #3
ID                                       : 5
Format                                   : PGS
Codec ID                                 : S_HDMV/PGS
Codec ID/Info                            : Picture based subtitle format used on BDs/HD-DVDs
Duration                                 : 59 min 56 s
Title                                    : French
Language                                 : French
Default                                  : No
Forced                                   : No

Text #4
ID                                       : 6
Format                                   : PGS
Codec ID                                 : S_HDMV/PGS
Codec ID/Info                            : Picture based subtitle format used on BDs/HD-DVDs
Duration                                 : 59 min 10 s
Title                                    : Spanish
Language                                 : Spanish
Default                                  : No
Forced                                   : No

Menu
00:00:00.000                             : Chapter 1
00:07:10.180                             : Chapter 2
00:12:51.729                             : Chapter 3
00:21:10.603                             : Chapter 4
00:29:53.959                             : Chapter 5
00:35:55.028                             : Chapter 6
00:46:23.739                             : Chapter 7
00:53:40.968                             : Chapter 8
00:59:35.238                             : Chapter 9

Application version

1.2 (4)

Where did you install the app from?

TestFlight

Device information

iPhone 14 Pro Max

OS version

iOS 18.0.1

Jellyfin server version

10.9.11

@ikheetjeff ikheetjeff added the bug Something isn't working label Oct 6, 2024
@ikheetjeff ikheetjeff changed the title Can't select subtitles, it jumps back to none. Can't select subtitles, it jumps back to none Oct 6, 2024
@cebrusfs
Copy link
Contributor

cebrusfs commented Oct 6, 2024

It might be some trick cases that my workaround doesn't handle well.

I think @LePips is working on refactoring related code in #1203. I hope it fix this if the whole logic is re-written.

BTW, it is good cases that we might want some unit-test to ensure this handled correctly.

@tobylibo

This comment has been minimized.

@Firestorm7893

This comment has been minimized.

@95mjeed

This comment has been minimized.

@95mjeed
Copy link

95mjeed commented Oct 12, 2024

Last update in AppStore indicates that the issue solved , did you guys still have it.
Since I still facing the issue and tried everything to workaround it but no luck.

@HanHwanHo

This comment has been minimized.

@cebrusfs
Copy link
Contributor

@LePips do you have any refactor progress could share? I am thinking if we should take immediate action to revert #1219 since the patch get more complain on this thread than #1207

@JPKribs
Copy link
Member

JPKribs commented Oct 18, 2024

I believe the goal is for this refactor to be shipped in the 1.3 final version:

#1265 (comment)

@justinkb
Copy link

justinkb commented Nov 5, 2024

seeing this issue still, shouldn't be that hard to fix, I'll take a look myself

@mattialuzi

This comment has been minimized.

Gondnat added a commit to Gondnat/Swiftfin that referenced this issue Nov 11, 2024
Gondnat added a commit to Gondnat/Swiftfin that referenced this issue Nov 11, 2024
@justinkb
Copy link

anyone tried to verify if Gondnat's changes fix the issue? if they do, would be great to have them merged and an update pushed to app store

@KirovAir
Copy link

Jeah +1 for this issue. It's quite an essential feature which can be off putting for new users of the live app in the appstore.
I have some spare time lately and some very moderate Swift-experience. I'll try if I can help out with either testing the code changes or contributing a fix.

@SkyDiver7199

This comment has been minimized.

@95mjeed

This comment has been minimized.

@ikheetjeff

This comment has been minimized.

@KillsT3aler69

This comment has been minimized.

@Bz16
Copy link

Bz16 commented Jan 8, 2025

I can still see the same issue on Testflight version 1.3(3), reproduced with external ASS, external VTT, and external SUBRIP.

Note that internal ASS (in a mkv container with internal ttf attachment) and image-based sub/idx subtitles will display (since they are considered incompatible and transcoding is done to burn them in), but any selections in an attempt to change subtitles or turn them off will not work.

Before that, on the 1.2 Appstore release, the subtitles sometimes works because the video starts playing with them on, but scrubbing or locking and unlocking the screen will make them go away with no way to bring them back. I have not found a way to reliably reproduce this behavior.

I don't know if Testflight 1.3(3) includes the changes made by Gondnat above... I am not versed in compiling from source and testing iOS apps at all and I hope my limited help can get us somewhere. Please let me know if I can provide any additional information.

@dongu54321

This comment has been minimized.

@alvitali

This comment has been minimized.

1 similar comment
@pes502

This comment has been minimized.

@Cyrilvallez
Copy link

I'm experiencing weird subtitles issues as well... For some files, I have english subs directly in the mkv file, as well as external french sub. On jellyfin I can basically play any sub. On Swiftfin however, it's another story. On apple tv, I can see both files to choose from correctly (marked as english and french), but whichever I select only the french subtitles are displayed. On iPhone, I can see 2 subtitles files to choose from, but they are both marked as the french subtitle, and I cannot display either one anyway...

Would love to see a fix as this is truly an important feature! Would do it myself if I could, but I literally have 0 experience in swift...

@BushMasterJM

This comment has been minimized.

@JPKribs
Copy link
Member

JPKribs commented Feb 28, 2025

I'm in the busy season at my job so I don't know if I have a lot of bandwidth to own this, but I did have a chance to do some research on this. I added my code and what I found on the #1311 so hopefully that is able to assist them get these changes in before the final 1.3 version is released.


Before

Type Internal Subtitles Internal Audio External Subtitles External Audio
Transcode 🟡*
DirectPlay

After

Type Internal Subtitles Internal Audio External Subtitles External Audio
Transcode 🟡*
DirectPlay 🟡*

What is going on?

Direct Play

Jellyfin provides the full file with all video & audio tracks included. External tracks from Jellyfin are provided at the beginning while VLCKit needs them at the end. To resolve the external track issue, we move all internal track indexes to the beginning and all external tracks to the end. As a result, all tracks are playable. I found external audio was playable but only if it did not require transcoding.

Transcodes

Jellyfin provides a transcoded file that only contains 1 video track and 1 audio track. Subtitle tracks are accessible using index 2+. To resolve the external subtitle track issue, I start the subtitles at index 2 and count up with each one. It's very simple but in testing, this was working without fail.

To make this work fully, there is a lot of reworking that I think #1203 is already covering. The gist of this is we would need to better follow how it's done here:

https://github.com/jellyfin/jellyfin-web/blob/master/src/components/playback/playbackmanager.js#L1691

On Jellyfin-Web, transcodes don't try to change the selected audio track because transcodes don't have a second audio track. Instead, they create a new PlaybackURL with the selected track and switch the user over to that using the changeStream function. This then takes the previous position in playback and uses that as the starting position for the new PlaybackURL. Subtitles are accessible via their own DeliveryURLs so those can be selected without requiring a new PlaybackURL. VLCKit complicates this a bit as it's purely a File/M3U handler.

I would argue, for now, the solution I provided gets us ~70% of the way there with minimal impact to #1203 & the VideoPlaybackManager. It's far from a perfect solution but that would require us to build out the VideoPlaybackManager which is already in process in #1203.


Unknowns

I don't personally use external subtitles, preferring to encode everything into MKV. As a result, all of my testing was using files I created specifically for this. This leaves us with some potential unknowns and test cases that need to be validated:

  1. Does having or not having https://github.com/jellyfin/jellyfin-plugin-subtitleextract change the result?
  2. Does the number of external tracks impact anything?
  3. Does having no internal subtitles change anything?

Testing

I have all of my changes made here: https://github.com/JPKribs/Swiftfin/tree/trackSelection if you know how to pull and build from XCode. Any assistance in eliminating some of our Unknowns (see above) would be a great help!

Since #1311 was initiated by another contributor, I want to respect their ownership of that work. I don't intend on creating any competing PRs, and I'm happy to let them decide which aspects of this implementation they'd like to incorporate. I just wanted to provide this work in the hopes that it helps us better resolve this issue. Additionally, I hope to put out a call for testers since there is a lot of variation between how people use Jellyfin. Testers ensure we better capture edge cases.

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

Successfully merging a pull request may close this issue.