• 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 Support Troubleshooting SOLVED: Subtitle extraction

    Pages (2): « Previous 1 2

     
    • 1 Vote(s) - 5 Average

    SOLVED: Subtitle extraction

    subtitle extraction help
    wolfrumble4398
    Offline

    Junior Member

    Posts: 9
    Threads: 3
    Joined: 2024 May
    Reputation: 0
    Country:Singapore
    #11
    2024-05-04, 03:29 PM
    (2024-05-03, 12:35 PM)TheDreadPirate Wrote: Yes and yes.  Though if deleted in file explorer Jellyfin won't delete the subtitles until the next scan or if real time monitoring is enabled.

    Thanks for the clarification!
    seseau1
    Offline

    Junior Member

    Posts: 1
    Threads: 0
    Joined: 2024 May
    Reputation: 0
    Country:France
    #12
    2024-05-15, 04:52 PM (This post was last modified: 2024-05-15, 04:53 PM by seseau1. Edited 1 time in total.)
    Hi, very sorry for necroing this thread!

    I'm going through the same thing, and trying to figure out how to match the extracted subtitles to the actual media. As stated in the thread earlier, the extracted subs are named in a seemingly random fashion which does seem to match the MD5 ID of the file, but I don't know how to match them. In Jellyfin, extracted subtitled don't appear in the subs options even after I've extracted them.

    For more context, I am trying to make use of the dual subtitles feature which Jellyfin just implemented, but it only lets you select secondary subtitles if you select external subs to begin with for the primary subs. If I select embedded subs, I am not given the option to select secondary subtitles. As a result, I am trying to extract the embedded subs so I can use them as "external" subs and trigger secondary subs.

    Thanks!
    TheDreadPirate
    Offline

    Community Moderator

    Posts: 15,374
    Threads: 10
    Joined: 2023 Jun
    Reputation: 460
    Country:United States
    #13
    2024-05-15, 04:58 PM
    Jellyfin keeps track of the extracted subtitles in the database (library.db). Same with images and other metadata that Jellyfin manages centrally.
    Jellyfin 10.10.7 (Docker)
    Ubuntu 24.04.2 LTS w/HWE
    Intel i3 12100
    Intel Arc A380
    OS drive - SK Hynix P41 1TB
    Storage
        4x WD Red Pro 6TB CMR in RAIDZ1
    [Image: GitHub%20Sponsors-grey?logo=github]
    sjorge
    Offline

    Junior Member

    Posts: 22
    Threads: 0
    Joined: 2023 Nov
    Reputation: 0
    Country:Belgium
    #14
    2024-08-10, 12:52 PM (This post was last modified: 2024-08-11, 10:28 AM by sjorge. Edited 6 times in total.)
    (2024-05-03, 12:35 PM)TheDreadPirate Wrote: Yes and yes.  Though if deleted in file explorer Jellyfin won't delete the subtitles until the next scan or if real time monitoring is enabled.

    Sadly it doesn't look like they ever get cleaned up.

    Code:
    Aug 09 07:32:59 fqdn jellyfin[398659]: [07:32:59] [INF] ffmpeg subtitle extraction completed for /mm/Series/Rick and Morty (2013)/Rick and Morty - S07E05 - Unmortricken.mkv to /var/lib/jellyfin/data/subtitles/0/0e230db0-1f4f-93f3-f642-8b95ce07cb12.srt
    ...
    Aug 10 14:43:23 fqdn jellyfin[398659]: [14:43:23] [INF] Removing item, Type: Series, Name: Rick and Morty, Path: /mm/Series/Rick and Morty (2013), Id: 2c6787f7-72aa-ef8d-588a-2ac214b2d1a0

    One would expect the subtitles to be removed in this case. But it's still there.

    Code:
    root@node:~# ls -l /var/lib/jellyfin/data/subtitles/0/0e230db0-1f4f-93f3-f642-8b95ce07cb12.srt
    -rw-r--r-- 1 jellyfin jellyfin 22685 Aug  9 07:32 /var/lib/jellyfin/data/subtitles/0/0e230db0-1f4f-93f3-f642-8b95ce07cb12.srt

    Even after 2 additional 'Scan All Libraries' and the scheduled tasks Subtitle Extract (would not expect this to clean it up looking at the code) and Clean Cache Directory (Most likely candidated) have run.

    I can also not find any reference in the code to where this gets cleaned up, just the Subtitle Extract task will call the function to extract subtitles, which will check they exist already first. And playback of an item requiring subs will also trigger the same call. But there is no delete happening everywhere, as far as I can see, there is also no reference to this in the database. I would have perhaps expected library.db -> mediastreams to have been updated with a complete Path field pointing to the cache, but this is also not the case.

    If I do every find a way to cleanup old files here, I'll edit this post but for now it seems to be very hard to do. Aside from nuking everything in that dir and running Subtitle Extract again which will then obviously not extract subtitles for the media that got removed.

    Edit: writing a script to do it is not going to be easy Slightly-frowning-face I tried something in python and typescript (the two languages I know but their date functions lack the required persision that C# has)

    Edit 2:

    Very much as-is as this is the first C# code I have written in over 10 years ...
    https://gist.github.com/sjorge/db3661f5d...6cdc85eb4e

    I made sure subtitle extract ran, dropped a .ignore, ran a scan all libraries.
    Then ran the little program above, I'm not very happy with the code quality but it gets the job done.

    Code:
    sjorge@node:~$ sudo -u jellyfin /var/lib/jellyfin/.cron/jf_subtitle_cache_cleaner
    Opening /var/lib/jellyfin/data/library.db ...
    Looking up subtitle mediastreams ...
    Detected 35085 valid subtitle cache paths.
    Subtitle cache: purged=88, kept=35085

    I guess this could be cleaned up and turned into a seperate scheduled task... not sure that would be acceptable though.

    Edit 3: I filed an issue https://github.com/jellyfin/jellyfin-plu.../issues/35
    Pages (2): « Previous 1 2

    « 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