Commit Graph

280 Commits

Author SHA1 Message Date
Oggeb1 4207e89a7d Merge branch 'jellyfin:master' into BDMV-pgs 2026-08-29 14:02:22 +02:00
Cody Robibero 9ba91d4583 Normalize fix, apply in more places 2026-08-20 18:10:50 -04:00
Shadowghost a8da0664a3 Fix GHSA-wwwm-px48-fpvq
# Conflicts:
#	MediaBrowser.MediaEncoding/Subtitles/SubtitleEncoder.cs
2026-08-20 17:51:42 -04:00
Oskar Bali 0b20d7a05b Fix BDMV PGS subtitles with TrueHD
Add myself CONTRIBUTORS.md
2026-08-19 12:19:32 +02:00
Tim Eisele ed61acc19a Fix subtitle encoding for local files (#17281)
* Fix subtitle encoding

* Add short-circuit

* Use IsTextFormat

* Update MediaBrowser.MediaEncoding/Subtitles/SubtitleEncoder.cs

Co-authored-by: Bond-009 <bond.009@outlook.com>

---------

Co-authored-by: Bond-009 <bond.009@outlook.com>
2026-07-21 14:52:59 +02:00
Cody Robibero f2b9c68969 Merge pull request #17342 from LTe/fix-subtitle-conversion-race
Fix race condition in concurrent subtitle conversion
2026-07-20 19:51:44 -04:00
Marc Brooks cab108a839 Prevent ffmpeg from hanging extracting subtitles (#17297)
* Prevent ffmpeg from hanging extracting subtitles
Add `RunSubtitleExtractionProcess` to unify the external
_ffmpeg_ process handling and error management.
Add a `-nostdin` flag that prevents _ffmpeg_ from reading from
_stdin_ and blocking on an inherited stdin handle (e.g. when
Jellyfin runs as a service under NSSM), which otherwise hangs
subtitle extraction forever when _ffmpeg_ blocks on any
keyboard-interaction read until the timeout (30 minutes).
Close the redirected _stdin_ to ensure immediage EOF.
Drain the _stderr_ to a string and log it, to ensure we don't block
the _ffmpeg_ process on errors that exceed the pipe length.
Pass `-y` to _ffmpeg_ to ensure it overwrites any existing output file
without prompting for confirmation.

* Address review comments
Make sure we always drain stderr.
Make sure the timeout also honors the cancellationToken.
Make sure when we get cancelled we don't log it as a ffmpeg error.
2026-07-17 23:23:57 +02:00
Piotr Niełacny 6e3c187493 Fix race condition in concurrent subtitle conversion
SubtitleEncoder.ConvertSubtitles parsed subtitles with libse's static
Subtitle.Parse, which iterates a statically cached list of shared
SubtitleFormat instances. Format parsers keep mutable per-parse state on
the instance, so concurrent subtitle requests corrupted each other's
output (cues mixed across streams and languages, truncated files) or
failed with NullReferenceException when format detection broke down and
Subtitle.Parse returned null.

Parse through the injected ISubtitleParser instead. SubtitleEditParser
instantiates a fresh format parser per call, so requests no longer share
state. Its Parse method now returns the libse Subtitle directly (the
SubtitleTrackInfo flattening was unused since the SubtitleEdit writer
rework) so the writers keep full fidelity such as ASS styling.
2026-07-15 14:55:55 +02:00
theguymadmax e2d9d592bc Fix incorrect protocol used for subtitle charset detection 2026-07-11 17:33:06 -04:00
Shadowghost a96824f257 Merge remote-tracking branch 'upstream/master' into fix-external-sub-invalidation 2026-06-05 23:41:05 +02:00
Shadowghost efb0336369 Fix subtitle replacement not invalidating cache 2026-06-05 14:14:27 +02:00
Bond_009 d69de6ccc4 Prefer subtitle extension over codec 2026-06-01 20:57:59 +02:00
Bond-009 54463929d0 Write subtitles using SubtitleEdit (#16805)
* Write subtitles using SubtitleEdit

We've been using SubtitleEdit to parse since 2021
https://github.com/jellyfin/jellyfin/pull/4984

I think it's time we start using it to write too

* Clean up ConvertSubtitles

* Add JsonWriter back
2026-06-01 19:43:57 +02:00
Neptune 6f0ff89bdc Add support for VobSub subtitle streams (#16552)
* Add support for VobSub subtitle streams

* update logic to determine separate extraction for VobSub subtitles

* simplify VobSub extraction logic and fix ffmpeg command

* Match `ExtractAllExtractableSubtitlesMKS` with `ExtractAllExtractableSubtitlesInternal` Matroska's VobSub option

* Add a comments clarify why MKS was used, and remove the redundant VobSub extension branch

* remove redundant VobSub format check

* fix type errors
2026-05-31 17:18:25 +02:00
Bond_009 1dd02b0e30 Add JsonWriter back 2026-05-30 21:42:57 +02:00
Bond_009 2b6da44815 Clean up ConvertSubtitles 2026-05-30 21:42:19 +02:00
Bond_009 941298ee81 Write subtitles using SubtitleEdit
We've been using SubtitleEdit to parse since 2021
https://github.com/jellyfin/jellyfin/pull/4984

I think it's time we start using it to write too
2026-05-30 21:09:10 +02:00
jakobkukla 37350282cc Run tree-wide dotnet format 2026-05-21 20:48:41 +02:00
Tim Eisele a9865367d8 Safeguard against invalid GUIDs (#16813)
Safeguard against invalid GUIDs
2026-05-12 18:12:54 +02:00
nyanmisaka e75f7f1b28 Avoid SSA to ASS conversion and loss of styles
Signed-off-by: nyanmisaka <nst799610810@gmail.com>
2026-05-02 21:36:34 +08:00
Hilmar Gústafsson 8ba9319f27 fix: retain subtitles spanning HLS segment boundaries (#16594)
fix: retain subtitles spanning HLS segment boundaries
2026-04-15 19:11:29 +02:00
Molier 42e8a780ca Backport pull request #16440 from jellyfin/release-10.11.z
Remove -copyts and add -flush_packets 1 to subtitle extraction

Original-merge: ec33c74ec4

Merged-by: Bond-009 <bond.009@outlook.com>

Backported-by: Bond_009 <bond.009@outlook.com>
2026-03-30 14:08:05 -04:00
lowbit 3997e016fa Backport pull request #16257 from jellyfin/release-10.11.z
Fix subtitle extraction caching empty files

Original-merge: 6864e108b8

Merged-by: joshuaboniface <joshua@boniface.me>

Backported-by: Bond_009 <bond.009@outlook.com>
2026-03-13 15:33:06 -04:00
lostb1t 7f1a0ff6fc wip 2025-12-21 14:34:27 +01:00
lostb1t 8d8d38600e wip 2025-12-21 14:34:27 +01:00
lostb1t e5a2acd6dd ise codec before path on format selection 2025-12-21 14:34:27 +01:00
lostb1t ddc613cd72 fix CA2007 2025-12-21 14:34:27 +01:00
lostb1t fa99b1d81c fix: remote subtitles 2025-12-21 14:34:27 +01:00
Karolis 5182aec13f Add subtitle extraction timeout configuration option 2025-11-17 15:18:29 +02:00
Tim Eisele 9c298c52f5 Expose ExtractAllExtractableSubtitles (#14876) 2025-09-26 13:45:01 -06:00
evan314159 2618a5fba2 Fix sync disposal of async-created IAsyncDisposable objects (#14755) 2025-09-16 11:14:52 +02:00
renovate[bot] dea500b26b Update dependency UTF.Unknown to 2.6.0 (#14599)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Bond_009 <bond.009@outlook.com>
2025-08-11 13:06:24 -06:00
Carsten Braun 98daf4aedb Use string.IsNullOrEmpty instead of regular null check. 2025-06-07 21:51:08 +02:00
Carsten Braun fcf56b73cb When subtitle is embedded in the main video file, the path will be null. 2025-06-07 21:51:08 +02:00
Carsten Braun e8239a7ee2 Do not attempt to extract internal subtitles if there are only MKS subtitles. 2025-06-07 21:51:08 +02:00
Carsten Braun 84cebeae64 Skip early if subtitle is in MKS to avoid unnecessary function calls. 2025-06-07 21:51:08 +02:00
Carsten Braun c0e2875818 If subtitles are part of an MKS, it is not an error. Just log for debug purpose and continue. 2025-06-07 21:51:08 +02:00
Carsten Braun 411ba03bf0 Fixed formatting 2025-06-07 21:51:08 +02:00
Carsten Braun b2e19c0306 Also extract subtitles of MKS aux files if they're extractable. 2025-06-07 21:51:08 +02:00
Tim Eisele 596b635511 Cleanup extracted files (#13760)
* Cleanup extracted files

* Pagination and fixes

* Add migration for attachments to MigrateLibraryDb

* Unify attachment handling

* Don't extract again if files were already extracted

* Fix MKS attachment extraction

* Always run full extraction on mks

* Don't try to extract mjpeg streams as attachments

* Fallback to check if attachments were extracted to cache folder

* Fixup
2025-04-03 09:17:14 -06:00
alltilla eb4162f9ec Backport pull request #13384 from jellyfin/release-10.10.z
Fix parallel use of not thread-safe SubtitleFormat instance

Original-merge: 0b2a59e963

Merged-by: joshuaboniface <joshua@boniface.me>

Backported-by: Bond_009 <bond.009@outlook.com>
2025-02-03 16:59:08 -05:00
oxixes d2c2dcd53c Solve CodeQL issue 2024-09-11 11:43:02 +02:00
jaina heartles 7c3c0aa940 Use subtitle cache when burning-in subs 2024-09-11 10:03:08 +02:00
dmitrylyzo 84b20afe1f Backport pull request #12575 from jellyfin/release-10.9.z
Fix subtitle and attachment extraction when input path contains quotes

Original-merge: 3c3ebe8344

Merged-by: Bond-009 <bond.009@outlook.com>

Backported-by: Joshua M. Boniface <joshua@boniface.me>
2024-09-07 18:09:54 -04:00
Łukasz 1451cbc39e Add subtitle parser errors to log if available (#12479) 2024-09-06 07:47:06 -06:00
David Schulte fc1bee30a6 Allow streaming of raw PGS subtitles without transcoding (#12056) 2024-07-15 08:48:09 -04:00
Mark Cilia Vincenti af74aa35d7 Clean up synchronization (#11458) 2024-05-05 19:21:54 -06:00
gnattu 658a454d81 fix: don't extract external sub (#11373) 2024-04-17 10:44:04 -06:00
felix920506 3cf0070287 Escape subtitle extraction input path (#10992) 2024-02-10 22:51:09 -07:00
Mark Cilia Vincenti f26fc7dfb2 Merge changes 2024-02-03 08:45:14 +01:00