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

2 Bugs/Improvements - Subtitle won't refresh when changing tracks / Load External Subtitle By Default? #34

Closed
EliCodesForFun opened this issue Jul 20, 2021 · 9 comments
Assignees
Labels
bug Something isn't working

Comments

@EliCodesForFun
Copy link

EliCodesForFun commented Jul 20, 2021

Hello,

One issue I'm having is on a show with multiple subtitle tracks, it won't actually change to the selected subtitle track. It loads the first subtitle in alphabetical order that's embedded on a .mkv, so Arabic in my example. I try to change it to Chinese Simplified, and after I select the new subtitle, it won't reload the subtitles for the video, so it's stuck just displaying Arabic.

My second thing is a suggestion: Use a fuzzysearch to open related subtitle files and add them into the subtitle list - this would help dealing with lots of shows with external subtitles.
example:
Are You OK Episode 01 iQiyi 1920x1080.mp4
Are You OK Episode 01 iQiyi 1920x1080.en.srt
Are You OK Episode 01 iQiyi 1920x1080.zh-CN.srt

This is the common naming convention, where all subtitles include the full filename, and append a language code after a period (.)
I think this is related to the File Picker, but I'm not sure how to override that on Android...

I hope to see these fixes or a clarification with this app, if no one else is experiencing the issue.

Vlad

@lrorpilla
Copy link
Owner

Could you please share some metadata about the video? My player requires use of SRT/ASS subtitles in order to make text selection work and the issue that you're experiencing may be related to PGS subtitles, which are unsupported and cannot possibly be converted to text without OCR.

@lrorpilla
Copy link
Owner

lrorpilla commented Jul 20, 2021

On the second suggestion, I don't intend to extend support to multiple external subtitles as it complicates things as is with scoped storage and external subtitle issues caused by higher Android SDKs - a single external subtitle is enough. It is also a prescriptive decision - users aren't supposed to be referring back to native language subtitles in the first place. If you mean to auto-load external subtitles (with subtitles only the same name as the current video filename), that's already performed and it may be issues with the file picker if it doesn't work.

@EliCodesForFun
Copy link
Author

EliCodesForFun commented Jul 20, 2021

Could you please share some metadata about the video? My player requires use of SRT/ASS subtitles in order to make text selection work and the issue that you're experiencing may be related to PGS subtitles, which are unsupported and cannot possibly be converted to text without OCR.

General
Unique ID : 181042371821126069676257415034399341837 (0x88337E15173C0F0C8F6A1F0F3067BD0D)
Complete name : J:\Google Drive\Chinese TV Shows Beginner\Heaven's Official Blessing (Tian Guan Ci Fu) + Special [1080p][multisub][GST] Tian Guan Ci Fu - 01 [1080p][Multi-Subs].mkv
Format : Matroska
Format version : Version 4
File size : 205 MiB
Duration : 18 min 42 s
Overall bit rate mode : Variable
Overall bit rate : 1 528 kb/s
Encoded date : UTC 2021-04-09 12:42:24
Writing application : mkvmerge v56.0.0 ('Strasbourg / St. Denis') 64-bit
Writing library : libebml v1.4.2 + libmatroska v1.6.4

Video
ID : 1
Format : AVC
Format/Info : Advanced Video Codec
Format profile : High@L4
Format settings : CABAC / 4 Ref Frames
Format settings, CABAC : Yes
Format settings, Reference : 4 frames
Codec ID : V_MPEG4/ISO/AVC
Duration : 18 min 39 s
Bit rate mode : Variable
Bit rate : 1 400 kb/s
Maximum bit rate : 20.0 Mb/s
Width : 1 920 pixels
Height : 1 080 pixels
Display aspect ratio : 16:9
Frame rate mode : Constant
Frame rate : 23.976 (24000/1001) FPS
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 0.028
Stream size : 187 MiB (91%)
Writing library : x264 core 148 r2722 1b0121b
Encoding settings : cabac=1 / ref=4 / deblock=1:0:0 / analyse=0x3:0x111 / me=umh / subme=10 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=120 / chroma_me=1 / trellis=2 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=6 / lookahead_threads=1 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / stitchable=1 / constrained_intra=0 / bframes=16 / b_pyramid=2 / b_adapt=2 / b_bias=0 / direct=3 / weightb=1 / open_gop=0 / weightp=2 / keyint=240 / keyint_min=121 / scenecut=0 / intra_refresh=0 / rc_lookahead=240 / rc=crf / mbtree=1 / crf=21.0 / qcomp=0.50 / qpmin=6 / qpmax=51 / qpstep=4 / vbv_maxrate=20000 / vbv_bufsize=25000 / crf_max=0.0 / nal_hrd=vbr / filler=0 / ip_ratio=1.40 / aq=1:0.80
Default : Yes
Forced : No

Audio
ID : 2
Format : E-AC-3
Format/Info : Enhanced AC-3
Commercial name : Dolby Digital Plus
Codec ID : A_EAC3
Duration : 18 min 42 s
Bit rate mode : Constant
Bit rate : 128 kb/s
Channel(s) : 2 channels
Channel layout : L R
Sampling rate : 48.0 kHz
Frame rate : 31.250 FPS (1536 SPF)
Compression mode : Lossy
Delay relative to video : -83 ms
Stream size : 17.1 MiB (8%)
Language : Chinese
Service kind : Complete Main
Default : Yes
Forced : No

Text #1
ID : 3
Format : UTF-8
Codec ID : S_TEXT/UTF8
Codec ID/Info : UTF-8 Plain Text
Duration : 17 min 26 s
Bit rate : 135 b/s
Count of elements : 302
Stream size : 17.3 KiB (0%)
Title : Arabic
Language : Arabic
Default : No
Forced : No

Text #2
ID : 4
Format : UTF-8
Codec ID : S_TEXT/UTF8
Codec ID/Info : UTF-8 Plain Text
Duration : 17 min 2 s
Bit rate : 84 b/s
Count of elements : 297
Stream size : 10.5 KiB (0%)
Title : English
Language : English
Default : Yes
Forced : No

Text #3
ID : 5
Format : UTF-8
Codec ID : S_TEXT/UTF8
Codec ID/Info : UTF-8 Plain Text
Duration : 17 min 26 s
Bit rate : 86 b/s
Count of elements : 301
Stream size : 11.1 KiB (0%)
Title : Spanish
Language : Spanish
Default : No
Forced : No

Text #4
ID : 6
Format : UTF-8
Codec ID : S_TEXT/UTF8
Codec ID/Info : UTF-8 Plain Text
Duration : 17 min 26 s
Bit rate : 79 b/s
Count of elements : 299
Stream size : 10.2 KiB (0%)
Title : European Spanish
Language : Spanish
Default : No
Forced : No

Text #5
ID : 7
Format : UTF-8
Codec ID : S_TEXT/UTF8
Codec ID/Info : UTF-8 Plain Text
Duration : 17 min 26 s
Bit rate : 75 b/s
Count of elements : 301
Stream size : 9.65 KiB (0%)
Title : French
Language : French
Default : No
Forced : No

Text #6
ID : 8
Format : UTF-8
Codec ID : S_TEXT/UTF8
Codec ID/Info : UTF-8 Plain Text
Duration : 17 min 1 s
Bit rate : 202 b/s
Count of elements : 301
Stream size : 25.2 KiB (0%)
Title : Hindi
Language : Hindi
Default : No
Forced : No

Text #7
ID : 9
Format : UTF-8
Codec ID : S_TEXT/UTF8
Codec ID/Info : UTF-8 Plain Text
Duration : 17 min 2 s
Bit rate : 74 b/s
Count of elements : 293
Stream size : 9.30 KiB (0%)
Title : Indonesian
Language : Indonesian
Default : No
Forced : No

Text #8
ID : 10
Format : UTF-8
Codec ID : S_TEXT/UTF8
Codec ID/Info : UTF-8 Plain Text
Duration : 17 min 26 s
Bit rate : 76 b/s
Count of elements : 302
Stream size : 9.74 KiB (0%)
Title : Italian
Language : Italian
Default : No
Forced : No

Text #9
ID : 11
Format : UTF-8
Codec ID : S_TEXT/UTF8
Codec ID/Info : UTF-8 Plain Text
Duration : 17 min 2 s
Bit rate : 78 b/s
Count of elements : 300
Stream size : 9.83 KiB (0%)
Title : Malay
Language : Malay
Default : No
Forced : No

Text #10
ID : 12
Format : UTF-8
Codec ID : S_TEXT/UTF8
Codec ID/Info : UTF-8 Plain Text
Duration : 17 min 26 s
Bit rate : 75 b/s
Count of elements : 302
Stream size : 9.61 KiB (0%)
Title : Portuguese
Language : Portuguese
Default : No
Forced : No

Text #11
ID : 13
Format : UTF-8
Codec ID : S_TEXT/UTF8
Codec ID/Info : UTF-8 Plain Text
Duration : 17 min 26 s
Bit rate : 75 b/s
Count of elements : 301
Stream size : 9.64 KiB (0%)
Title : Brazilian Portuguese
Language : Portuguese
Default : No
Forced : No

Text #12
ID : 14
Format : UTF-8
Codec ID : S_TEXT/UTF8
Codec ID/Info : UTF-8 Plain Text
Duration : 15 min 15 s
Bit rate : 219 b/s
Count of elements : 307
Stream size : 24.6 KiB (0%)
Title : Thai
Language : Thai
Default : No
Forced : No

Text #13
ID : 15
Format : UTF-8
Codec ID : S_TEXT/UTF8
Codec ID/Info : UTF-8 Plain Text
Duration : 17 min 2 s
Bit rate : 101 b/s
Count of elements : 301
Stream size : 12.7 KiB (0%)
Title : Vietnamese
Language : Vietnamese
Default : No
Forced : No

Text #14
ID : 16
Format : UTF-8
Codec ID : S_TEXT/UTF8
Codec ID/Info : UTF-8 Plain Text
Duration : 15 min 7 s
Bit rate : 72 b/s
Count of elements : 341
Stream size : 8.00 KiB (0%)
Title : Chinese Simplified
Language : Chinese
Default : No
Forced : No

Text #15
ID : 17
Format : UTF-8
Codec ID : S_TEXT/UTF8
Codec ID/Info : UTF-8 Plain Text
Duration : 17 min 2 s
Bit rate : 65 b/s
Count of elements : 343
Stream size : 8.20 KiB (0%)
Title : Chinese Traditional
Language : Chinese
Default : No
Forced : No

Text selection works, it's just unable to changed from Arabic over to simplified Chinese.
Here's the actual file - https://www.mediafire.com/file/tf2g5r20su2xyqg/[GST]+Tian+Guan+Ci+Fu+-+01+[1080p][Multi-Subs].mkv/file

Here's a clip of me using the app - https://streamable.com/wo098e

@EliCodesForFun
Copy link
Author

EliCodesForFun commented Jul 20, 2021

On the second suggestion, I don't intend to extend support to multiple external subtitles as it complicates things as is with scoped storage and external subtitle issues caused by higher Android SDKs - a single external subtitle is enough. It is also a prescriptive decision - users aren't supposed to be referring back to native language subtitles in the first place. If you mean to auto-load external subtitles (with subtitles only the same name as the current video filename), that's already performed and it may be issues with the file picker if it doesn't work.

What is your method for changing the file manager? Is there a recommended alternative one? I literally just hit Player and it opens.
Another problem is that when I go back to play this episode via the history, even though I've added in the external subtitle file, it's set to start the video with "Subtitle - none" and when I selected the Subtitle track that's already above it, it won't enable the subtitles. This is again an issue with the subtitle switching not working while playing videos. I can record a clip of this and edit my post in a minute.

Here's a clip: https://streamable.com/gbd20o

I edited my previous post and added a clip for the previous issue as well.

@lrorpilla lrorpilla added the bug Something isn't working label Jul 20, 2021
@lrorpilla lrorpilla self-assigned this Jul 20, 2021
@lrorpilla
Copy link
Owner

lrorpilla commented Jul 20, 2021

Seems this is a complicated issue that would be a bit hard to explain.

In order to generate the transcript and enable me to pull text into the program, the subtitles are actually extracted from the video file when the video is loaded. I hard set the maximum number of subtitles to be extracted to 10, and your video has way over this amount, that's why simplified Chinese at the very end could not be selected.

It is impossible for me to pull subtitle data from the VLC player I use. To be able to have the entire subtitle from start to finish, I have to perform file operations on the video file in order to be able to display subtitles. When you select "Simplified Chinese", it's supposed to select an extracted subtitle file, and it didn't exist since extraction was not performed to that index.

External subtitles are loaded if no subtitle menu options are lit in the menu. If you were selecting something like Track $number, that was a blank option that did not work, and I'm fixing that problem now.

@lrorpilla
Copy link
Owner

lrorpilla commented Jul 21, 2021

The primary issue of subtitles above a certain index not being selectable has been resolved in 0.25.8.

I understand that some users are unable to import subtitles by default due to scoped storage issues. There is nothing I can do about this and this is a consequence of the direction that Android has simply decided to take with their files policy. For this reason, I cannot at this stage implement load by default for the devices that are already implementing this aggressive change. This feature would require me to be able to obtain the absolute URI path of the picked video which I simply cannot get on a certain SDK level.

I am very frustrated about this. The only remedy for this on higher SDK levels is to use the scoped storage branch I've provided and pick external subtitle files manually.

If there are any other issues, feel free to re-open. With that, I'm closing this issue.

@EliCodesForFun
Copy link
Author

EliCodesForFun commented Jul 21, 2021

External subtitles are loaded if no subtitle menu options are lit in the menu. If you were selecting something like Track $number, that was a blank option that did not work, and I'm fixing that problem now.

Wouldn't this mean that if a show has softsubs, it wouldn't load the external subtitle file?
I would say that the majority of people learning Japanese are using the blu-rays of anime, which contain embedded softsubs, and an external .srt file which contains the Japanese subtitles.

So, I would highly suggest that your app be changed so that it loads an external subtitle file if possible.
If it's not possible to load multiple external .srt files, I guess that's fine, but I think at least always loading and prioritizing the external subtitle (because the external is likely the target language subtitle file) would be good.
This is the default behavior for most modern media players (VLC, mpc-hc, mpv) - they load the external subtitle file and prioritize it over any internal subtitles.
From my testing, it won't automatically load an external file so my Japanese .srt won't be applied over the show.
I think it's a hassle if all of your users have to remux their shows to use the app.
Renaming my .zh-CN.srt to just {filename}.srt is doable, but remuxing dozens of shows isn't feasible.

I think it's important for people to be able to go right from 1 episode to the next, and not have to remux their encodes in order to use their app, as downloading the raws for shows has yet to become the standard. I really hope you can fix this up, because this app is very exciting.

Thank you.
(P.S. my examples are Chinese because your app works well with the Chinese yomichan dictionaries and I'm learning Chinese as well)

@lrorpilla
Copy link
Owner

lrorpilla commented Jul 21, 2021

It does auto-load an external subtitle file, as I've described. There are Android file API issues that get in the way with this behavior which causes an issue for some number of users, but the functionality is there -- and works up for most users up to Android 10, myself included. All you have to do is rename the subtitle file to have the same name as the video file.

Android 11 (and some minority of Android 10 users) is where users have to manually import, again because of scoped storage. Only the video file is cached and I do not have access to the raw URI path in order to get the subtitles as well.

I consider this a very critical issue considering that sooner or later users will ditch their phones for newer devices and everyone will have to put up with scoped storage. A fix might have to be resorting to MediaStore and newer Android SAF methods in order to pick the video file, and then get the similarly named subtitle path by the raw URI. I need to investigate my options, and it is likely that I am at the mercy of what alternatives I have given that I use Flutter and hence am limited in the ways to instance a File on Flutter.

@EliCodesForFun
Copy link
Author

It does auto-load an external subtitle file, as I've described. There are Android file API issues that get in the way with this behavior which causes an issue for some number of users, but the functionality is there -- and works up to most users using Android 10, myself included. All you have to do is rename the subtitle file to have the same name as the video file.

Android 11 (and some minority of Android 10 users) is where users have to manually import, again because of scoped storage. Only the video file is cached and I do not have access to the raw URI path in order to get the subtitles as well.

I consider this a very critical issue considering that sooner or later users will ditch their phones for newer devices and everyone will have to put up with scoped storage. A fix might have to be resorting to MediaStore and newer Android SAF methods in order to pick the video file, and then get the similarly named subtitle path by the raw URI. I need to investigate my options, and it is likely that I am at the mercy of what alternatives I have given that I use Flutter and hence am limited in the ways to instance a File on Flutter.

Aah, I took a break and I misunderstood what you meant. I get what you mean now. I just tried it on my Xiaomi along with my Galaxy with the scopedstorage version of the 0.25.8-beta. Still not autoloading the external subs, but that other issue was indeed fixed as you said.

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

2 participants