Merge pull request #11079 from crobibero/bdinfo-codec

Always use ffmpeg codec for bluray
This commit is contained in:
Bond-009 2024-03-01 10:25:11 -05:00 committed by GitHub
commit 5a4aff36c1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -324,20 +324,7 @@ namespace MediaBrowser.Providers.MediaInfo
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
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
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;
}
}