Fix preset with normal aspect ratio
This commit is contained in:
11
minfo.py
11
minfo.py
@@ -202,15 +202,12 @@ class MediaInfo:
|
|||||||
|
|
||||||
self.keep_display_aspect = 0.95 < self.resolution.ratio / self.display_aspect_ratio.ratio < 1.05
|
self.keep_display_aspect = 0.95 < self.resolution.ratio / self.display_aspect_ratio.ratio < 1.05
|
||||||
|
|
||||||
if not self.keep_display_aspect:
|
if self.keep_display_aspect:
|
||||||
|
self.display_width = float(self.resolution.width)
|
||||||
|
self.pixel_aspect_ratio = Ratio(1, 1)
|
||||||
|
else:
|
||||||
self.display_width = self.resolution.height * self.display_aspect_ratio.ratio
|
self.display_width = self.resolution.height * self.display_aspect_ratio.ratio
|
||||||
self.pixel_aspect_ratio = self.display_aspect_ratio
|
self.pixel_aspect_ratio = self.display_aspect_ratio
|
||||||
else:
|
|
||||||
self.display_width = float(self.resolution.width)
|
|
||||||
self.pixel_aspect_ratio = Ratio(
|
|
||||||
self.display_aspect_ratio.x,
|
|
||||||
self.resolution.width
|
|
||||||
)
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def output_bitrate(self) -> int:
|
def output_bitrate(self) -> int:
|
||||||
|
|||||||
@@ -15,3 +15,19 @@ def test_square_source():
|
|||||||
|
|
||||||
assert info.resolution == Resolution(576, 576)
|
assert info.resolution == Resolution(576, 576)
|
||||||
assert info.pixel_aspect_ratio == Ratio(16, 9)
|
assert info.pixel_aspect_ratio == Ratio(16, 9)
|
||||||
|
|
||||||
|
|
||||||
|
def test_normal_source():
|
||||||
|
info = MediaInfo()
|
||||||
|
info.general = {
|
||||||
|
|
||||||
|
}
|
||||||
|
info.video = {
|
||||||
|
"Width": 1920,
|
||||||
|
"Height": 1080,
|
||||||
|
"DisplayAspectRatio": 1.778
|
||||||
|
}
|
||||||
|
info.determine_aspect_properties()
|
||||||
|
|
||||||
|
assert info.resolution == Resolution(1920, 1080)
|
||||||
|
assert info.pixel_aspect_ratio == Ratio(1, 1)
|
||||||
|
|||||||
Reference in New Issue
Block a user