diff --git a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs index a31a735bed..99305f8b14 100644 --- a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs +++ b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs @@ -7503,9 +7503,18 @@ namespace MediaBrowser.Controller.MediaEncoding var inputModifier = GetInputModifier(state, encodingOptions, null); + // Add timestamp normalization for progressive downloads + var timestampArgs = string.Empty; + if (state.TranscodingType == TranscodingJobType.Progressive && !state.BaseRequest.CopyTimestamps) + { + // For progressive downloads without copyTimestamps, ensure timestamps start at 0 + // This fixes seeking issues in strict players like mpv, iina, and infuse + timestampArgs = " -avoid_negative_ts make_zero -start_at_zero"; + } + return string.Format( CultureInfo.InvariantCulture, - "{0} {1}{2} {3} {4} -map_metadata -1 -map_chapters -1 -threads {5} {6}{7}{8} -y \"{9}\"", + "{0} {1}{2} {3} {4} -map_metadata -1 -map_chapters -1 -threads {5} {6}{7}{8}{9} -y \"{10}\"", inputModifier, GetInputArgument(state, encodingOptions, null), keyFrame, @@ -7514,6 +7523,7 @@ namespace MediaBrowser.Controller.MediaEncoding threads, GetProgressiveVideoAudioArguments(state, encodingOptions), GetSubtitleEmbedArguments(state), + timestampArgs, format, outputPath).Trim(); } @@ -7602,13 +7612,6 @@ namespace MediaBrowser.Controller.MediaEncoding args += " -start_at_zero"; } } - else if (state.TranscodingType == TranscodingJobType.Progressive && !state.BaseRequest.CopyTimestamps) - { - // For progressive downloads without copyTimestamps, ensure timestamps start at 0 - // This fixes seeking issues in strict players like mpv, iina, and infuse - args += " -avoid_negative_ts make_zero -start_at_zero"; - } - var qualityParam = GetVideoQualityParam(state, videoCodec, encodingOptions, defaultPreset); if (!string.IsNullOrEmpty(qualityParam))