Tweak high end bitrates to lower
This commit is contained in:
39
minfo.py
39
minfo.py
@@ -209,25 +209,6 @@ class MediaInfo:
|
|||||||
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
|
||||||
|
|
||||||
@property
|
|
||||||
def output_bitrate(self) -> int:
|
|
||||||
if self.codec == "MPEG-4 Visual":
|
|
||||||
translations = [
|
|
||||||
Translation(0, 800, 0.5, 200, 600),
|
|
||||||
Translation(800, 1500, 0.4, 400, 800),
|
|
||||||
Translation(1500, 99999999999, 0.33, 600, 1200),
|
|
||||||
]
|
|
||||||
else:
|
|
||||||
translations = [
|
|
||||||
Translation(0, 800, 0.7, 450, 700),
|
|
||||||
Translation(800, 1500, 0.6, 550, 1000),
|
|
||||||
Translation(1500, 99999999999, 0.45, 800, 5000),
|
|
||||||
]
|
|
||||||
bitrate = self.bitrate
|
|
||||||
for t in translations:
|
|
||||||
if t.start <= bitrate < t.end:
|
|
||||||
return int(min(t.max_br, max(t.min_br, bitrate * t.multiplier)))
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def tracks(self) -> List[AudioInfo]:
|
def tracks(self) -> List[AudioInfo]:
|
||||||
result = []
|
result = []
|
||||||
@@ -239,3 +220,23 @@ class MediaInfo:
|
|||||||
@property
|
@property
|
||||||
def menu(self) -> MenuInfo:
|
def menu(self) -> MenuInfo:
|
||||||
return MenuInfo(self.menu_data or { self.duration: "Chapter 1" }, duration=self.duration)
|
return MenuInfo(self.menu_data or { self.duration: "Chapter 1" }, duration=self.duration)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def output_bitrate(self) -> int:
|
||||||
|
if self.codec == "MPEG-4 Visual":
|
||||||
|
translations = [
|
||||||
|
Translation(0, 800, 0.5, 200, 600),
|
||||||
|
Translation(800, 1500, 0.4, 400, 800),
|
||||||
|
Translation(1500, 99999999999, 0.33, 600, 2500),
|
||||||
|
]
|
||||||
|
else:
|
||||||
|
translations = [
|
||||||
|
Translation(0, 800, 0.7, 450, 700),
|
||||||
|
Translation(800, 1500, 0.6, 550, 1000),
|
||||||
|
Translation(1500, 4000, 0.45, 800, 2500),
|
||||||
|
Translation(4000, 99999999999, 0.33, 2000, 5000),
|
||||||
|
]
|
||||||
|
bitrate = self.bitrate
|
||||||
|
for t in translations:
|
||||||
|
if t.start <= bitrate < t.end:
|
||||||
|
return int(min(t.max_br, max(t.min_br, bitrate * t.multiplier)))
|
||||||
|
|||||||
Reference in New Issue
Block a user