• Login
  • Register
  • Login Register
    Login
    Username/Email:
    Password:
    Or login with a social network below
  • Forum
  • Website
  • GitHub
  • Status
  • Translation
  • Features
  • Team
  • Rules
  • Help
  • Feeds
User Links
  • Login
  • Register
  • Login Register
    Login
    Username/Email:
    Password:
    Or login with a social network below

    Useful Links Forum Website GitHub Status Translation Features Team Rules Help Feeds
    Jellyfin Forum Development Web Development Native PGS support

    Pages (2): 1 2 Next »

     
    • 0 Vote(s) - 0 Average

    Native PGS support

    Support native PGS (graphical subtitles) without transcoding
    Arcus
    Offline

    Junior Member

    Posts: 3
    Threads: 1
    Joined: 2024 Jun
    Reputation: 0
    Country:Germany
    #1
    2024-06-06, 09:45 PM (This post was last modified: 2024-07-11, 08:52 PM by Arcus. Edited 6 times in total. Edit Reason: Updated todo list )
    Hello,
    I'm currently working on a way to enable native PGS support without transcoding in the web-version of Jellyfin.

    Problem:

    I really dislike burned-in subtitles. I like my my media library to be as clean and as complete as possible with all audio tracks and all subtitles when digitize my Blue Rays. Blue Rays always have graphical subtitles (PGS - .sub) that cannot be converted into text subtitles. Graphical subtitles can only be displayed with video transcoding. I'm using a NAS without GPU support, so transcoding even a 1080p video is reaching the CPUs limit. Also the video quality drops.

    I've built a tool that converts the video with all audio tracks into a MP4 using stream-friendly codecs. Then I extract all PGS subtitles, store them as .sub files next to the video. Then I run an automatic script to OCR the images and create an SRT file. The OCR only works half the time. Some images can't be read at all and are empty and every tenth word has a typo.
    Yes, I'm obsessed with having a perfect media collection...

    Solution:
    Allow Jellyfin to stream raw .sub files to the client and let the client render the graphical subtitles on-top of the video.

    Tasks / Status:
    • JavaScript PGS renderer - Implemented
    • Steam external PGS (.sup / .sub files) - Implemented
    • Steam embedded PGS (eg. from .mkv) - Implemented
    • Subtitle time offset - Implemented
    • Background rendering via WebWorker - Implemented
    • Compression - Pending
    • Setting to disable/enable PGS streaming - Implemented
    • Jellyfin Web - Implemented
    • Jellyfin Vue - Implemented
    • Jellyfin Android (web player) - Implemented by web player
    • Jellyfin Android (exo player) - Not supported by Exo
    • Jeyllfin Chromecast App - Implemented by web player
    • Jeyllfin Chromecast Quick Cast - Not supported by Chromecast?
    • Jeyllfin iOS - Missing hardware / Can't test
    • Jeyllfin AppleTV - Missing hardware/ Can't test

    Problems and limitations...
    • Currently the subtitle must be external. However, it is possible to use ffmpeg to export PGS streams.
    • PGS files are large ~ 20-40mb per full language per episode. Even more for movies.
    • Downloading can take some time on slower connections. It may delay the playback or subtitles aren't ready for the first seconds. I implemented an async pgs stream reader. Early subtitles can can be displayed while the rest of the pgs file is still downloading. Big win!
    • The player must load the whole PGS file into memory on playback. Partial reading isn't possible.
    • The PGS renderer has to be implemented for every player: Web, Android, iOS, etc.
    • Subtitle cropping isn't implemented yet. It is also not implemented in FFmpeg and the feature is properly not used anywhere...

    Repositories:
    • libpgs-js: https://github.com/Arcus92/libpgs-js
    • jellyfin: https://github.com/Arcus92/jellyfin/tree/native-pgs
    • jellyfin-web: https://github.com/Arcus92/jellyfin-web/tree/native-pgs
    • jellyfin-vue: https://github.com/Arcus92/jellyfin-vue/tree/native-pgs


    Is this something anyone is interested in or am I the only one who would benefit from this? Is this even in the spirit of the Jellyfin project? Is it worth to build a clean implementation from the prototype, so it could be merged some day?

    Thanks for reading all of this!
    1
    1
    1
    thornbill
    Offline

    Core Team

    Posts: 173
    Threads: 6
    Joined: 2023 Jun
    Reputation: 8
    Country:United States
    #2
    2024-06-06, 10:15 PM
    It sounds roughly similar to what we do for ASS/SSA subs, so I don’t see why we wouldn’t want to try it! 💜
    [Image: thornbill?style=flat&logo=github]
    nyanmisaka
    Offline

    Team Member

    Posts: 236
    Threads: 0
    Joined: 2023 Jun
    Reputation: 8
    #3
    2024-06-07, 03:06 AM (This post was last modified: 2024-06-07, 03:09 AM by nyanmisaka. Edited 1 time in total.)
    Considering that PGSSUB files are relatively large, we can apply some compression algorithm while transferring.

    This is the result given by 7zip fast: 182M vs 7.9M for a two hour subtitle    

    BTW I saw a similar project before. https://github.com/MathNuts/SUPtitles
    Arcen
    Offline

    Junior Member

    Posts: 2
    Threads: 1
    Joined: 2024 Jun
    Reputation: 0
    Country:Canada
    #4
    2024-06-07, 09:48 AM
    Have you tried TrOCR or other more recent OCR models? Obviously they're more computationally intense than, say, tesseract, but curious about results.
    Arcus
    Offline

    Junior Member

    Posts: 3
    Threads: 1
    Joined: 2024 Jun
    Reputation: 0
    Country:Germany
    #5
    2024-06-07, 11:31 PM
    (2024-06-07, 09:48 AM)Arcen Wrote: Have you tried TrOCR or other more recent OCR models? Obviously they're more computationally intense than, say, tesseract, but curious about results.
    No, I haven't tried that yet. But it looks promising.

    Using compression is a great idea. I'll have a look at this.


    Update: I've build a working prototype:
    • libpgs-js: https://github.com/Arcus92/libpgs-js
    • jellyfin: https://github.com/Arcus92/jellyfin/tree/native-pgs
    • jellyfin-web: https://github.com/Arcus92/jellyfin-web/tree/native-pgs

    It's still needs a lot of polish but it already works quite nicely.
    [Image: zY6qoKe.png]
    1
    1
    1
    ferferga
    Offline

    Team Member

    Posts: 6
    Threads: 0
    Joined: 2023 Jun
    Reputation: 0
    #6
    2024-06-15, 04:44 PM
    @Arcus are you interested in PRing it in Vue as well?
    [Image: ferferga?style=flat&logo=github]
    Arcus
    Offline

    Junior Member

    Posts: 3
    Threads: 1
    Joined: 2024 Jun
    Reputation: 0
    Country:Germany
    #7
    2024-06-21, 08:42 AM
    (2024-06-15, 04:44 PM)ferferga Wrote: @Arcus are you interested in PRing it in Vue as well?

    @ferferga Sorry, I missed your message. Yes, I've already looked at the vue project, but first I'll fix the performance concerns for the default client.
    1
    1
    1
    Mats
    Offline

    Junior Member

    Posts: 1
    Threads: 0
    Joined: 2024 Sep
    Reputation: 0
    Country:Norway
    #8
    2024-09-01, 11:13 AM
    I rebased everything atop the latest release and tested it. Can confirm it works well with the LG webOS client (including movies).

    Great work!
    Host-in-the-Shell
    Offline

    Member

    Posts: 166
    Threads: 10
    Joined: 2023 Jun
    Reputation: 14
    #9
    2024-09-01, 04:01 PM
    This sounds like a major addition to have, particularly for us who use WebOS Jellyfin as our primary client. Is this something that later down the line could be merged into the main repos? I don't know much about how the JF code works and what its limitations are, so that's why I'm asking.
    Server specs => OS: Debian 12 | GPU: Arc A380 | CPU: Ryzen 5 5600X | 64GB RAM | 56TB
    mistamoronic
    Offline

    Junior Member

    Posts: 16
    Threads: 2
    Joined: 2025 Jan
    Reputation: 0
    #10
    2025-01-15, 12:31 AM
    Excuse the noob question, but how can I use this?
    Pages (2): 1 2 Next »

    « Next Oldest | Next Newest »

    Users browsing this thread: 1 Guest(s)


    • View a Printable Version
    • Subscribe to this thread
    Forum Jump:

    Home · Team · Help · Contact
    © Designed by D&D - Powered by MyBB
    L


    Jellyfin

    The Free Software Media System

    Linear Mode
    Threaded Mode