GithubHelp home page GithubHelp logo

jellyfin-plugin-subtitleextract's Introduction

Subtitle Extract for Jellyfin Plugin

Part of the Jellyfin Project

Plugin Banner

GitHub Workflow Status MIT License Current Release

About

Plugin to automatically extract embedded subtitles.

Installation

See the official documentation for install instructions.

Build

  1. To build this plugin you will need .Net 6.x.

  2. Build plugin with following command

dotnet publish --configuration Release --output bin
  1. Place the dll-file in the plugins/subtitleextract folder (you might need to create the folders) of your JF install

Releasing

To release the plugin we recommend JPRM that will build and package the plugin. For additional context and for how to add the packaged plugin zip to a plugin manifest see the JPRM documentation for more info.

Contributing

We welcome all contributions and pull requests! If you have a larger feature in mind please open an issue so we can discuss the implementation before you start. In general refer to our contributing guidelines for further information.

Licence

This plugins code and packages are distributed under the MIT License. See LICENSE for more information.

jellyfin-plugin-subtitleextract's People

Contributors

crobibero avatar jellyfin-bot avatar kakoluz avatar methbkts avatar shemanaev avatar thornbill avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jellyfin-plugin-subtitleextract's Issues

Config page not visible

Noticed in the source there is a config page with a relatively handy setting to extract subs on library scan instead of a scheduled job, but trying to access the config page gives an alert with message: "This plugin has no settings to set up."

Seemlingly does nothing

I've installed the plugin and it doesn't seem to do anything. A lot of media still has embed subtitles. I've had it installed for a few weeks now for any scheduled tasks to run, I've ran a few media scans. I've played media. It stays embed. What am I doing wrong?

Running 4.0.0
Jellyfin 10.9.3

Subtitle Extract webhook

Is it possible to trigger a subtitle extract through a webhook?
I'd like to improve my sonarr/radarr setup by also extracting the subtitles when finishing the download of new content as it currently does with reloading jellyfin.

I do this with a webhook, so I'd like to be able to trigger subtitle extract in the same way.

Inclusion as default plugin for new installations of Jellyfin?

Hello! I ran into the slow subtitle loading issue today, and realized after half an hour of research that this was already fixed with this plugin. I was wondering if the plugin could be included by default in new Jellyfin installations as part of a proposal, as it is quite the bad experience for users if they fire up their content and the subtitles exhibit buggy behavior (slow loading, not loading at all, "Fetching additional data" spinning infinitely at the bottom right).

Or maybe this plugin can be recommended as part of the admin installation process ("you may want to install the subtitle extraction plugin to optimize your viewing experience"). Anything other than what I had to go through would be great for those just installing Jellyfin! Please let me know if this is a dumb idea and feel free to close the issue if so. :)

EDIT: reading over this I probably should clarify that I'm proposing for the plugin to be installed alongside Jellyfin for new installations. I'm already aware this is an official Jellyfin plugin included in the default repositories.

Store subtitles alongside file?

Hello, thanks for the plugin, was really nice to see this in the plugin list!

If I'm not mistaken it seems subtitles are being stored in "Jellyfin\Server\data\subtitles", is it possible to store the subs alongside the media files with the same name?

Thanks!

Extracted subtitles not being used when burning-in at transcode time

I have some files that I need to play with the subtitles burned in at transcode time, as the clients cannot all handle rendering ASS/SSA subs. I have ran the subtitle extraction process and confirmed that the subs were extracted. However, when playing the file, the transcode does not use the extracted subs, which causes the operation to time out as the original file is being read from a slow HDD and has a hard time extracting the subs at runtime.

I'm not sure if this is something that can be fixed using the plugin API or not, but I thought I'd ask.

It appears this has been mentioned in this issue.

Relevant system logs:

[2024-07-09 08:57:27.881 -07:00] [INF] [43] MediaBrowser.MediaEncoding.Subtitles.SubtitleEncoder: ffmpeg subtitle extraction completed for "/net/video/library/tv/Revolutionary Girl Utena/Specials/Revolutionary Girl Utena - S00E01 - Adolescence of Utena HDTV-720p.mkv" to "/var/lib/jellyfin/data/subtitles/7/7c97c353-e021-02b8-75e9-53e04615c53b.ass"

Transcode logs:

/nix/store/sahkv39jnsgwr7drg3ih7rlyhds7js35-jellyfin-ffmpeg-6.0.1-6-bin/bin/ffmpeg -analyzeduration 200M -probesize 1G -ss 00:06:18.000 -init_hw_device cuda=cu:0 -filter_hw_device cu -hwaccel cuda -hwaccel_output_format cuda -hwaccel_flags +unsafe_output -threads 1 -noautorotate -i file:"/net/video/library/movies/Adolescence of Utena (1999)/Revolutionary Girl Utena - The Adolescence of Utena.mkv" -noautoscale -map_metadata -1 -map_chapters -1 -threads 0 -map 0:0 -map 0:2 -map -0:0 -codec:v:0 h264_nvenc -preset p1 -b:v 9430520 -maxrate 9430520 -bufsize 18861040 -g:v:0 72 -keyint_min:v:0 72 -filter_complex "alphasrc=s=1920x1080:r=23.976025:start='00\:06\:18\.000',format=yuva420p,subtitles=f='/net/video/library/movies/Adolescence of Utena (1999)/Revolutionary Girl Utena - The Adolescence of Utena.mkv':si=1:alpha=1:sub2video=1:fontsdir='/var/cache/jellyfin/attachments/e2353f0a5273a9fae2d04f8290f19895',hwupload=derive_device=cuda[sub];[0:0]setparams=color_primaries=bt709:color_trc=bt709:colorspace=bt709,scale_cuda=format=yuv420p[main];[main][sub]overlay_cuda=eof_action=pass:repeatlast=0" -start_at_zero -codec:a:0 libmp3lame -ac 2 -ab 124507 -copyts -avoid_negative_ts disabled -max_muxing_queue_size 2048 -f hls -max_delay 5000000 -hls_time 3 -hls_segment_type mpegts -start_number 126 -hls_segment_filename "/var/lib/jellyfin/transcodes/71f22bc8b9940397c357c27844133e54%d.ts" -hls_playlist_type vod -hls_list_size 0 -y "/var/lib/jellyfin/transcodes/71f22bc8b9940397c357c27844133e54.m3u8"

Edit: Whoops, forgot to mention. This is running server version 10.9.3 and plugin version 4.0.0.0

Not working

Hi there

I’ve read a lot about this plugin, and frankly seems like exactly what I’m looking for.
after installing the plugin I’ve restarted the server, and ran the plugin.
Oddly it takes 2 seconds to complete. Afterwards I still can’t see any subtitles.
I’ve tried deleting and reinstalling the plugin a bunch of times. Not sure what I’ve done wrong or how to fix it, any ideas?

Extract font attachments related to subtitles

It would be nice to be possible the plugin to extract not only the subtitles, but the font attachments too. This way jellyfin will not need to do this when video is played and it will be possible to offload all the work when server is less loaded. This will help alot to machines with slower storage.

Extraction of the subs and font attachments can be batched all in 1 ffmpeg request to make things faster.

Other addition to the plugin can be a scheduled task to cleanup subtitles and font attachments that are left behind when videos/shows are deleted.

Other subtitles types

This plugin only support extraction of SRT and SSA/ASS sub types.
Why are other subs (vtt, idx, pgs, ...) excluded? Is there no benefit for Jellyfin to have these subtitles extracted?

Log storm with subtitleextract plugin v3 and jellyfin server v10.9.0

Hi,

after upgrading subtitleextract plugin to v3 and jellyfin server to v10.9.0 I see many many log lines every time subtitleextract task is fired, exactly one for each media file.

I suspect the cause is the extraction method change, as now all subtitles tracks in one file are extracted in one command.

But there is a way to avoid such log storm (for example checking before if there is the need to extract before do it)?

ps. I'm not sure if the issue should be opened in subtitleextract plugin repo or jellyfin server repo.

Subtitle "Unsupported format" errors with subtitleextract plugin v3 and jellyfin server v10.9.0

Hi,

after upgrading subtitleextract plugin to v3 and jellyfin server to v10.9.0 I see many "Unsupported format" during subtitle extraction.

For now I see two "Unsupported format" error types:

[2024-05-12 16:53:29.643 +02:00] [INF] [10] Jellyfin.Plugin.SubtitleExtract.Tools.SubtitlesExtractor: Extracting subtitles from "<FILE_PATH>"
[2024-05-12 16:53:29.649 +02:00] [WRN] [10] Jellyfin.Plugin.SubtitleExtract.Tools.SubtitlesExtractor: Unable to extract subtitle File:"<FILE_PATH>"
System.ArgumentException: Unsupported format: srt
   at MediaBrowser.MediaEncoding.Subtitles.SubtitleEditParser.Parse(Stream stream, String fileExtension)
   at MediaBrowser.MediaEncoding.Subtitles.SubtitleEncoder.ConvertSubtitles(Stream stream, String inputFormat, String outputFormat, Int64 startTimeTicks, Int64 endTimeTicks, Boolean preserveOriginalTimestamps, CancellationToken cancellationToken)
   at MediaBrowser.MediaEncoding.Subtitles.SubtitleEncoder.MediaBrowser.Controller.MediaEncoding.ISubtitleEncoder.GetSubtitles(BaseItem item, String mediaSourceId, Int32 subtitleStreamIndex, String outputFormat, Int64 startTimeTicks, Int64 endTimeTicks, Boolean preserveOriginalTimestamps, CancellationToken cancellationToken)
   at Jellyfin.Plugin.SubtitleExtract.Tools.SubtitlesExtractor.Run(BaseItem video, CancellationToken cancellationToken)

[2024-05-12 16:53:29.652 +02:00] [INF] [10] Jellyfin.Plugin.SubtitleExtract.Tools.SubtitlesExtractor: Extracting subtitles from "<FILE_PATH>"
[2024-05-12 16:53:29.745 +02:00] [WRN] [10] Jellyfin.Plugin.SubtitleExtract.Tools.SubtitlesExtractor: Unable to extract subtitle File:"<FILE_PATH>"
System.ArgumentException: Unsupported format: mov_text
   at MediaBrowser.MediaEncoding.Subtitles.SubtitleEncoder.GetWriter(String format)
   at MediaBrowser.MediaEncoding.Subtitles.SubtitleEncoder.ConvertSubtitles(Stream stream, String inputFormat, String outputFormat, Int64 startTimeTicks, Int64 endTimeTicks, Boolean preserveOriginalTimestamps, CancellationToken cancellationToken)
   at MediaBrowser.MediaEncoding.Subtitles.SubtitleEncoder.MediaBrowser.Controller.MediaEncoding.ISubtitleEncoder.GetSubtitles(BaseItem item, String mediaSourceId, Int32 subtitleStreamIndex, String outputFormat, Int64 startTimeTicks, Int64 endTimeTicks, Boolean preserveOriginalTimestamps, CancellationToken cancellationToken)
   at Jellyfin.Plugin.SubtitleExtract.Tools.SubtitlesExtractor.Run(BaseItem video, CancellationToken cancellationToken)

The case one is very strange, as srt subtitle format should be supported (maybe there was a string comparison check issue?).

In case two mov_text subtitle format should be converted in srt as done in subtitleextract plugin v2 for every subtitle form that is not srt, ass, or ssa.

ps. I'm not sure if the issue should be opened in subtitleextract plugin repo or jellyfin server repo.

Broken Image for Subtitle Extract

Overview

When looking at the plugin in the Catalog It will not show a Icon or the default icon in jellyfin

image

Steps to reproduce

  1. Open Catalog
  2. View Plugin

Please provide more documentation

As someone who is new to JF, it doesn't really help to read that a "Subtitle Extract" plugin "Extracts Subtitles" or to be more specific "Extracts embedded subtitles." :).

It would help if you explained why I'd want this, how it does it, etc.

Does "extract" mean, the subtitles are moved out of the video container or just "copied" for example.

1 errors encountered while parsing '"ass"' subtitle using the "Advanced Sub Station Alpha" format parser

Uhm, did the conversation work or not? I am not sure because of this error message.

[2024-06-09 13:13:25.803 +02:00] [INF] [28] Emby.Server.Implementations.IO.LibraryMonitor: "movies" ("/data/movies") will be refreshed.
[2024-06-09 13:13:25.958 +02:00] [INF] [55] Emby.Server.Implementations.Library.LibraryManager: Removing item, Type: "Movie", Name: "Robots", Path: "/data/movies/Robots (2005) [imdbid-tt0358082]/Robots (2005) [imdbid-tt0358082] - [Bluray-1080p][AC3 5.1][x265]-FuN.mkv", Id: 86de1b35-1dea-1cda-0377-f3c5f5707cd1
[2024-06-09 13:13:26.194 +02:00] [INF] [19] MediaBrowser.MediaEncoding.Encoder.MediaEncoder: Starting "/usr/lib/jellyfin-ffmpeg/ffprobe" with args "-analyzeduration 200M -probesize 1G -i file:\"/data/movies/Robots (2005) [imdbid-tt0358082]/Robots (2005) [imdbid-tt0358082] - [Bluray-1080p][DTS 5.1][x264]--.mkv\" -threads 0 -v warning -print_format json -show_streams -show_chapters -show_format"
[2024-06-09 13:13:39.667 +02:00] [INF] [19] Emby.Server.Implementations.HttpServer.WebSocketManager: WS "10.253.0.2" request
[2024-06-09 13:14:23.436 +02:00] [INF] [74] MediaBrowser.MediaEncoding.Subtitles.SubtitleEncoder: "/usr/lib/jellyfin-ffmpeg/ffmpeg" "-i \"/data/movies/Robots (2005) [imdbid-tt0358082]/Robots (2005) [imdbid-tt0358082] - [Bluray-1080p][DTS 5.1][x264]--.mkv\" -copyts -map 0:3 -an -vn -c:s copy \"/config/data/data/subtitles/2/29731ce4-36ce-e9d1-321b-42f0161b6c70.srt\""
[2024-06-09 13:14:57.418 +02:00] [INF] [19] MediaBrowser.MediaEncoding.Subtitles.SubtitleEncoder: ffmpeg subtitle extraction completed for "/data/movies/Robots (2005) [imdbid-tt0358082]/Robots (2005) [imdbid-tt0358082] - [Bluray-1080p][DTS 5.1][x264]--.mkv" to "/config/data/data/subtitles/2/29731ce4-36ce-e9d1-321b-42f0161b6c70.srt"
[2024-06-09 13:14:57.984 +02:00] [ERR] [19] MediaBrowser.MediaEncoding.Subtitles.SubtitleEditParser: 1 errors encountered while parsing '"ass"' subtitle using the "Advanced Sub Station Alpha" format parser
[2024-06-09 13:14:59.274 +02:00] [INF] [19] Emby.Server.Implementations.ScheduledTasks.TaskManager: "Subtitle Extract" Completed after 0 minute(s) and 35 seconds

Add an option to specify a library and have it run for only that library.

I'm generally happy with this plugin, but I don't need to have it ran for my entire library, most movies and normal tv shows come with SRT subtitles, and they tend to just work immediately. My main issue is naturally ASS/SSA subtitles, as they take a lot longer to load.

I made a bash script for now that does this for me sort of(extracts the ASS/SSA subtitles next to the container as an external subtitle). Being able to select a specific or multuple specific libraries in this plugin would be hugely appreciated.
I've built from source and the config option to extract on library scan is huge!

I would try to figure this out myself, but I have no idea where or how I would begin implementing it.

How does it work ?

Hi,

I would like to use this extension, but I don't have any clue on how it is supposed to behave within Jellyfin.
How to automatically extract subtitles when a new movie/serie is added ?
Does it need to be set up as a reccurent task ?

Regards,

Ability to write the extracted subtitle to media folder.

Would be nice to have a toggle to allow for the subtitle to be stored along with the media. The extraction process is quite time and energy consuming and doing it every time there needs to be a migration or recovery is not good. If the data is stored along with the media, then multiple installations won't have to run the process independently, backup sizes would be smaller and in case there needs to be some media re arrange or something, we won't loose everything. It would also be possible to have a more powerful system do the subtitle generation process and then turn off, and a weaker system can serve the files easily. I'm currently having to run a powerful desktop to do the extraction and serve Jellyfin than using a Pi to serve it.

Only extract specific languages

Hi, thanks for this plugin, it helps me deal with the problem of embedded subtitles.
I'm wondering if it would be possible to add configuration options in the plugin details for selecting one or more specific languages and make it so that only subtitles of those languages are extracted. Perhaps even offer the option to filter out HI/SDH subs?

It would help with some 4K videos that are over 20GB and have over 30 subtitles. The extraction from these files can take over an hour depending on the hardware where the extraction is running.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.