Backport pull request #18578 from jellyfin/release-12.z

Fix audio gaps when restarting HLS with copied video

Original-merge: 54e4dbb4fe

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

Backported-by: Cody Robibero <cody@robibe.ro>
This commit is contained in:
gnattu authored and Cody Robibero committed 2026-11-20 07:25:11 -05:00
1 parent 791ec9f8dc
commit 6042f4809e
2 files changed
+99

No files matched your search

@@ -3116,6 +3116,16 @@ namespace MediaBrowser.Controller.MediaEncoding
}
seekParam += string.Format(CultureInfo.InvariantCulture, "-ss {0}", _mediaEncoder.GetTimeParameter(seekTick));
// Retain audio from the preceding keyframe to match copied video's start time.
if (isHlsRemuxing
&& state.AudioStream is not null
&& !string.IsNullOrEmpty(state.OutputAudioCodec)
&& !IsCopyCodec(state.OutputAudioCodec)
&& !string.Equals(state.InputContainer, "wtv", StringComparison.OrdinalIgnoreCase))
{
seekParam += " -noaccurate_seek";
}
}
return seekParam;