Browse Source

Merge pull request #11079 from crobibero/bdinfo-codec

Always use ffmpeg codec for bluray
Bond-009 1 year ago
parent
commit
5a4aff36c1
1 changed files with 8 additions and 19 deletions
  1. 8 19
      MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs

+ 8 - 19
MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs

@@ -324,20 +324,7 @@ namespace MediaBrowser.Providers.MediaInfo
                 return;
                 return;
             }
             }
 
 
-            // Use BD Info if it has multiple m2ts. Otherwise, treat it like a video file and rely more on ffprobe output
-            int? currentHeight = null;
-            int? currentWidth = null;
-            int? currentBitRate = null;
-
-            var videoStream = mediaStreams.FirstOrDefault(s => s.Type == MediaStreamType.Video);
-
-            // Grab the values that ffprobe recorded
-            if (videoStream is not null)
-            {
-                currentBitRate = videoStream.BitRate;
-                currentWidth = videoStream.Width;
-                currentHeight = videoStream.Height;
-            }
+            var ffmpegVideoStream = mediaStreams.FirstOrDefault(s => s.Type == MediaStreamType.Video);
 
 
             // Fill video properties from the BDInfo result
             // Fill video properties from the BDInfo result
             mediaStreams.Clear();
             mediaStreams.Clear();
@@ -361,14 +348,16 @@ namespace MediaBrowser.Providers.MediaInfo
                 }
                 }
             }
             }
 
 
-            videoStream = mediaStreams.FirstOrDefault(s => s.Type == MediaStreamType.Video);
+            var blurayVideoStream = mediaStreams.FirstOrDefault(s => s.Type == MediaStreamType.Video);
 
 
             // Use the ffprobe values if these are empty
             // Use the ffprobe values if these are empty
-            if (videoStream is not null)
+            if (blurayVideoStream is not null && ffmpegVideoStream is not null)
             {
             {
-                videoStream.BitRate = videoStream.BitRate.GetValueOrDefault() == 0 ? currentBitRate : videoStream.BitRate;
-                videoStream.Width = videoStream.Width.GetValueOrDefault() == 0 ? currentWidth : videoStream.Width;
-                videoStream.Height = videoStream.Height.GetValueOrDefault() == 0 ? currentHeight : videoStream.Height;
+                // Always use ffmpeg's detected codec since that is what the rest of the codebase expects.
+                blurayVideoStream.Codec = ffmpegVideoStream.Codec;
+                blurayVideoStream.BitRate = blurayVideoStream.BitRate.GetValueOrDefault() == 0 ? ffmpegVideoStream.BitRate : blurayVideoStream.BitRate;
+                blurayVideoStream.Width = blurayVideoStream.Width.GetValueOrDefault() == 0 ? ffmpegVideoStream.Width : blurayVideoStream.Width;
+                blurayVideoStream.Height = blurayVideoStream.Height.GetValueOrDefault() == 0 ? ffmpegVideoStream.Width : blurayVideoStream.Height;
             }
             }
         }
         }