From 51abf6f503dae58428f3558e77805f2937335d8f Mon Sep 17 00:00:00 2001 From: crobibero Date: Tue, 15 Sep 2026 11:15:47 -0400 Subject: Backport pull request #17883 from jellyfin/release-12.z Fix trickplay using the wrong video stream Original-merge: 31f05331911748eeda047be92f19dfd801b9fff6 Merged-by: crobibero Backported-by: Cody Robibero --- MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'MediaBrowser.MediaEncoding/Encoder') diff --git a/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs b/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs index f64fd73763..fa43d756a4 100644 --- a/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs +++ b/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs @@ -922,6 +922,15 @@ namespace MediaBrowser.MediaEncoding.Encoder inputArg = "-hwaccel_flags +low_priority " + inputArg; } + // Force the video stream, otherwise ffmpeg may pick a cover image. + var streamIndex = EncodingHelper.FindIndex(mediaSource.MediaStreams, imageStream); + if (streamIndex < 0) + { + throw new InvalidOperationException($"Unable to locate requested stream {imageStream.Title}"); + } + + inputArg += " -map 0:" + streamIndex; + var filterParam = encodingHelper.GetVideoProcessingFilterParam(jobState, options, vidEncoder).Trim(); if (string.IsNullOrWhiteSpace(filterParam)) { -- cgit v1.2.3 From bc753b18ec5923ae1f3026cfe4ad51534521ab2a Mon Sep 17 00:00:00 2001 From: SimonvBez <31727669+SimonvBez@users.noreply.github.com> Date: Tue, 15 Sep 2026 11:15:54 -0400 Subject: Backport pull request #17906 from jellyfin/release-12.z Fix transcode throttling not enabling on supported systems (caused by race condition) Original-merge: b8b6e392bf9f01b691c63e8ce91fdde7a8276344 Merged-by: crobibero Backported-by: Cody Robibero --- CONTRIBUTORS.md | 1 + MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs | 8 +++----- 2 files changed, 4 insertions(+), 5 deletions(-) (limited to 'MediaBrowser.MediaEncoding/Encoder') diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index a97d335170..f5f844bcbc 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -138,6 +138,7 @@ - [SegiH](https://github.com/SegiH) - [SenorSmartyPants](https://github.com/SenorSmartyPants) - [shemanaev](https://github.com/shemanaev) + - [SimonvBez](https://github.com/SimonvBez) - [skaro13](https://github.com/skaro13) - [sl1288](https://github.com/sl1288) - [Smith00101010](https://github.com/Smith00101010) diff --git a/MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs b/MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs index 91d0c3d5a6..99c08eb9a1 100644 --- a/MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs +++ b/MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs @@ -193,8 +193,6 @@ namespace MediaBrowser.MediaEncoding.Encoder private readonly string _encoderPath; - private readonly Version _minFFmpegMultiThreadedCli = new Version(7, 0); - public EncoderValidator(ILogger logger, string encoderPath) { _logger = logger; @@ -552,9 +550,9 @@ namespace MediaBrowser.MediaEncoding.Encoder string output; try { - // With multi-threaded cli support, FFmpeg 7 is less sensitive to keyboard input - var duration = ffmpegVersion >= _minFFmpegMultiThreadedCli ? 10000 : 1000; - output = GetProcessOutput(_encoderPath, $"-hide_banner -f lavfi -i nullsrc=s=1x1:d={duration} -f null -", true, "?"); + // Start a dummy encode of 1x1@1fps. Send '?' to stdin to get the help/keybind text, followed by 'q' to stop the job immediately + // As a safeguard in case 'q' doesn't stop the job, the dummy input has a max duration of 5 (realtime) seconds + output = GetProcessOutput(_encoderPath, $"-hide_banner -re -f lavfi -i nullsrc=s=1x1:r=1:d=5 -f null -", true, "?q"); } catch (Exception ex) { -- cgit v1.2.3