From 257ce496682b83ee9631e32ab5b84266078f4d21 Mon Sep 17 00:00:00 2001 From: realzombee <209545148+realzombee@users.noreply.github.com> Date: Wed, 28 Jan 2026 01:58:54 +0000 Subject: [PATCH] fix(ffprobe): Pass the correct filtered video stream index - We currently pass the global stream index of the primary video stream with v:index. - ffprobe expects the index to be filtered by the stream type. If the video appears at index 2 but is the only video stream in the file, we should pass v:0. Passing v:2 will cause ffprobe to unnecessarily read the entire file during analysis --- .../MediaFiles/MediaInfo/VideoFileInfoReader.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/NzbDrone.Core/MediaFiles/MediaInfo/VideoFileInfoReader.cs b/src/NzbDrone.Core/MediaFiles/MediaInfo/VideoFileInfoReader.cs index cbfb17e888..f5baf4323f 100644 --- a/src/NzbDrone.Core/MediaFiles/MediaInfo/VideoFileInfoReader.cs +++ b/src/NzbDrone.Core/MediaFiles/MediaInfo/VideoFileInfoReader.cs @@ -117,7 +117,10 @@ public MediaInfoModel GetMediaInfo(string filename) // if it looks like PQ10 or similar HDR, do a frame analysis to figure out which type it is if (PqTransferFunctions.Contains(mediaInfoModel.VideoTransferCharacteristics)) { - var frameOutput = FFProbe.GetFrameJson(filename, ffOptions: new () { ExtraArguments = $"-read_intervals \"%+#1\" -select_streams v:{primaryVideoStream?.Index ?? 0}" }); + var videoStreamIndex = analysis.VideoStreams.FindIndex(stream => stream.Index == primaryVideoStream?.Index); + videoStreamIndex = videoStreamIndex == -1 ? 0 : videoStreamIndex; + _logger.Debug("Reading video stream at index {0} with relative index v:{1}", primaryVideoStream?.Index, videoStreamIndex); + var frameOutput = FFProbe.GetFrameJson(filename, ffOptions: new () { ExtraArguments = $"-read_intervals \"%+#1\" -select_streams v:{videoStreamIndex}" }); mediaInfoModel.RawFrameData = frameOutput; frames = FFProbe.AnalyseFrameJson(frameOutput);