The Free Software Media System - Server Backend & API
Merge remote-tracking branch 'upstream/master' into fmp4-hls
nyanmisaka488dbdb31d90
diff --cc Jellyfin.Api/Controllers/DynamicHlsController.csindex fc13fb8735,6e59da798c..28357091bb--- a/Jellyfin.Api/Controllers/DynamicHlsController.cs+++ b/Jellyfin.Api/Controllers/DynamicHlsController.cs@@@ -1368,17 -1341,18 +1369,18 @@@ namespace Jellyfin.Api.Controllerstate.BaseRequest.BreakOnNonKeyFrames = false;}- var inputModifier = _encodingHelper.GetInputModifier(state, encodingOptions);-// If isEncoding is true we're actually starting ffmpegvar startNumberParam = isEncoding ? startNumber.ToString(CultureInfo.InvariantCulture) : "0";-+ var inputModifier = _encodingHelper.GetInputModifier(state, _encodingOptions);var mapArgs = state.IsOutputVideo ? _encodingHelper.GetMapArgs(state) : string.Empty;+ var directory = Path.GetDirectoryName(outputPath) ?? throw new ArgumentException($"Provided path ({outputPath}) is not valid.", nameof(outputPath));+ var outputFileNameWithoutExtension = Path.GetFileNameWithoutExtension(outputPath);- var outputPrefix = Path.Combine(Path.GetDirectoryName(outputPath), outputFileNameWithoutExtension);++ var outputPrefix = Path.Combine(directory, outputFileNameWithoutExtension);+ var outputExtension = GetSegmentFileExtension(state.Request.SegmentContainer);+ var outputTsArg = outputPrefix + "%d" + outputExtension;- var outputTsArg = Path.Combine(directory, Path.GetFileNameWithoutExtension(outputPath)) + "%d" + GetSegmentFileExtension(state.Request.SegmentContainer);-- var segmentFormat = GetSegmentFileExtension(state.Request.SegmentContainer).TrimStart('.');+ var segmentFormat = outputExtension.TrimStart('.');if (string.Equals(segmentFormat, "ts", StringComparison.OrdinalIgnoreCase)){segmentFormat = "mpegts";diff --cc Jellyfin.Api/Controllers/VideoHlsController.csindex aebfeab673,389dc8a088..b03402c1b0--- a/Jellyfin.Api/Controllers/VideoHlsController.cs+++ b/Jellyfin.Api/Controllers/VideoHlsController.cs@@@ -361,14 -361,11 +362,15 @@@ namespace Jellyfin.Api.Controllervar videoCodec = _encodingHelper.GetVideoEncoder(state, _encodingOptions);var threads = _encodingHelper.GetNumberOfThreads(state, _encodingOptions, videoCodec);var inputModifier = _encodingHelper.GetInputModifier(state, _encodingOptions);- var format = !string.IsNullOrWhiteSpace(state.Request.SegmentContainer) ? "." + state.Request.SegmentContainer : ".ts";+ var mapArgs = state.IsOutputVideo ? _encodingHelper.GetMapArgs(state) : string.Empty;++ var directory = Path.GetDirectoryName(outputPath) ?? throw new ArgumentException($"Provided path ({outputPath}) is not valid.", nameof(outputPath));- var outputTsArg = Path.Combine(directory, Path.GetFileNameWithoutExtension(outputPath)) + "%d" + format;+ var outputFileNameWithoutExtension = Path.GetFileNameWithoutExtension(outputPath);- var outputPrefix = Path.Combine(Path.GetDirectoryName(outputPath), outputFileNameWithoutExtension);++ var outputPrefix = Path.Combine(directory, outputFileNameWithoutExtension);+ var outputExtension = HlsHelpers.GetSegmentFileExtension(state.Request.SegmentContainer);+ var outputTsArg = outputPrefix + "%d" + outputExtension;- var segmentFormat = format.TrimStart('.');+ var segmentFormat = outputExtension.TrimStart('.');if (string.Equals(segmentFormat, "ts", StringComparison.OrdinalIgnoreCase)){segmentFormat = "mpegts";