aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.MediaEncoding
diff options
context:
space:
mode:
authorGene <68919132+GeneMarks@users.noreply.github.com>2025-08-15 20:52:43 -0400
committerGitHub <noreply@github.com>2025-08-15 18:52:43 -0600
commit28b8d3ee29c693f1bb04e41dee23570bd4cf468d (patch)
tree8e9ed5c5596383dfa7ed911f8d4dc51a6859df7d /MediaBrowser.MediaEncoding
parent9eaca73888e59d349a8fb935266efa98b0b4c9fe (diff)
fix: correct anamorphic video detection (#14640) (#14648)
Diffstat (limited to 'MediaBrowser.MediaEncoding')
-rw-r--r--MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs34
1 files changed, 29 insertions, 5 deletions
diff --git a/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs b/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs
index 5784deacd..997c7d2a4 100644
--- a/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs
+++ b/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs
@@ -850,12 +850,36 @@ namespace MediaBrowser.MediaEncoding.Probing
}
}
- // stream.IsAnamorphic = string.Equals(streamInfo.sample_aspect_ratio, "0:1", StringComparison.OrdinalIgnoreCase) ||
- // string.Equals(stream.AspectRatio, "2.35:1", StringComparison.OrdinalIgnoreCase) ||
- // string.Equals(stream.AspectRatio, "2.40:1", StringComparison.OrdinalIgnoreCase);
-
// http://stackoverflow.com/questions/17353387/how-to-detect-anamorphic-video-with-ffprobe
- stream.IsAnamorphic = string.Equals(streamInfo.SampleAspectRatio, "0:1", StringComparison.OrdinalIgnoreCase);
+ if (string.Equals(streamInfo.SampleAspectRatio, "1:1", StringComparison.OrdinalIgnoreCase))
+ {
+ stream.IsAnamorphic = false;
+ }
+ else if (!string.Equals(streamInfo.SampleAspectRatio, "0:1", StringComparison.OrdinalIgnoreCase))
+ {
+ stream.IsAnamorphic = true;
+ }
+ else if (string.Equals(streamInfo.DisplayAspectRatio, "0:1", StringComparison.OrdinalIgnoreCase))
+ {
+ stream.IsAnamorphic = false;
+ }
+ else if (!string.Equals(
+ streamInfo.DisplayAspectRatio,
+ // Force GetAspectRatio() to derive ratio from Width/Height directly by using null DAR
+ GetAspectRatio(new MediaStreamInfo
+ {
+ Width = streamInfo.Width,
+ Height = streamInfo.Height,
+ DisplayAspectRatio = null
+ }),
+ StringComparison.OrdinalIgnoreCase))
+ {
+ stream.IsAnamorphic = true;
+ }
+ else
+ {
+ stream.IsAnamorphic = false;
+ }
if (streamInfo.Refs > 0)
{