From 8d052a6cb17421e6c7774bafc6957029f3c9d4ae Mon Sep 17 00:00:00 2001
From: Abitofevrything <54505189+abitofevrything@users.noreply.github.com>
Date: Sun, 18 Jan 2026 12:17:06 +0100
Subject: Merge pull request #15926 from
abitofevrything/feat/accurate_hls_seeking
Refactor HLS transcode seeking
---
.../Configuration/EncodingOptions.cs | 8 ++++++++
.../Configuration/HlsAudioSeekStrategy.cs | 23 ++++++++++++++++++++++
2 files changed, 31 insertions(+)
create mode 100644 MediaBrowser.Model/Configuration/HlsAudioSeekStrategy.cs
(limited to 'MediaBrowser.Model/Configuration')
diff --git a/MediaBrowser.Model/Configuration/EncodingOptions.cs b/MediaBrowser.Model/Configuration/EncodingOptions.cs
index f7f386d289..98fc2e632f 100644
--- a/MediaBrowser.Model/Configuration/EncodingOptions.cs
+++ b/MediaBrowser.Model/Configuration/EncodingOptions.cs
@@ -1,6 +1,7 @@
#pragma warning disable CA1819 // XML serialization handles collections improperly, so we need to use arrays
#nullable disable
+using System.ComponentModel;
using MediaBrowser.Model.Entities;
namespace MediaBrowser.Model.Configuration;
@@ -60,6 +61,7 @@ public class EncodingOptions
SubtitleExtractionTimeoutMinutes = 30;
AllowOnDemandMetadataBasedKeyframeExtractionForExtensions = ["mkv"];
HardwareDecodingCodecs = ["h264", "vc1"];
+ HlsAudioSeekStrategy = HlsAudioSeekStrategy.DisableAccurateSeek;
}
///
@@ -301,4 +303,10 @@ public class EncodingOptions
/// Gets or sets the file extensions on-demand metadata based keyframe extraction is enabled for.
///
public string[] AllowOnDemandMetadataBasedKeyframeExtractionForExtensions { get; set; }
+
+ ///
+ /// Gets or sets the method used for audio seeking in HLS.
+ ///
+ [DefaultValue(HlsAudioSeekStrategy.DisableAccurateSeek)]
+ public HlsAudioSeekStrategy HlsAudioSeekStrategy { get; set; }
}
diff --git a/MediaBrowser.Model/Configuration/HlsAudioSeekStrategy.cs b/MediaBrowser.Model/Configuration/HlsAudioSeekStrategy.cs
new file mode 100644
index 0000000000..49feeb435f
--- /dev/null
+++ b/MediaBrowser.Model/Configuration/HlsAudioSeekStrategy.cs
@@ -0,0 +1,23 @@
+namespace MediaBrowser.Model.Configuration
+{
+ ///
+ /// An enum representing the options to seek the input audio stream when
+ /// transcoding HLS segments.
+ ///
+ public enum HlsAudioSeekStrategy
+ {
+ ///
+ /// If the video stream is transcoded and the audio stream is copied,
+ /// seek the video stream to the same keyframe as the audio stream. The
+ /// resulting timestamps in the output streams may be inaccurate.
+ ///
+ DisableAccurateSeek = 0,
+
+ ///
+ /// Prevent audio streams from being copied if the video stream is transcoded.
+ /// The resulting timestamps will be accurate, but additional audio transcoding
+ /// overhead will be incurred.
+ ///
+ TranscodeAudio = 1,
+ }
+}
--
cgit v1.2.3