Now honors the maximum bitrate for each different format (Added specific maximum bitrates for each resolution in DivX and MKV/H264)

This commit is contained in:
Sergio Costas 2014-12-26 13:21:04 +01:00
parent 68b874d71a
commit a69b040dbf
2 changed files with 23 additions and 5 deletions

View file

@ -49,6 +49,7 @@ Some of the future ideas to add to Devede NG are, without an specific order:
## History of versions ## ## History of versions ##
* version 0.1 beta 4 (2014-12-25) * version 0.1 beta 4 (2014-12-25)
* Now ensures that the maximum bitrate is honored * Now ensures that the maximum bitrate is honored
* Added the maximum bitrates for each available format
* version 0.1 beta 3 (2014-12-21) * version 0.1 beta 3 (2014-12-21)
* Fixed the subtitle colors * Fixed the subtitle colors

View file

@ -312,22 +312,30 @@ class devede_project:
fixed_size += ((audio_rate + sub_rate) * time_length) fixed_size += ((audio_rate + sub_rate) * time_length)
# 76800 = 320x240, which is the smallest resolution # 76800 = 320x240, which is the smallest resolution
surface = ((float(width) * float(height)) / 76800.0) * float(time_length) surface = ((float(width) * float(height)) / 76800.0) * float(time_length)
to_adjust.append( (f, surface, time_length, audio_rate) ) to_adjust.append( (f, surface, time_length, audio_rate, height) )
total_resolution += surface total_resolution += surface
if (self.disc_type == "dvd") and (self.wcreate_menu.get_active()): if (self.disc_type == "dvd") and (self.wcreate_menu.get_active()):
fixed_size += self.menu.get_estimated_size() * 8.0 fixed_size += self.menu.get_estimated_size() * 8.0
if (self.disc_type == "dvd"): if (self.disc_type == "dvd"):
max_bps = 9000 max_bps_base = {0: 9000}
min_bps = 300 min_bps = 300
max_total = 10000 max_total = 10000
elif (self.disc_type == "svcd") or (self.disc_type == "cvd"): elif (self.disc_type == "svcd") or (self.disc_type == "cvd"):
max_bps = 2700 max_bps_base = {0: 2700}
min_bps = 300 min_bps = 200
max_total = 2700 max_total = 2700
elif (self.disc_type == "divx"):
max_bps_base = {0: 4854, 720: 9708, 1080: 20000}
min_bps = 300
max_total = -1
elif (self.disc_type == "mkv"):
max_bps_base = {0: 192, 240: 2000, 480: 14000, 720: 50000, 1080: 240000}
min_bps = 192
max_total = -1
else: else:
max_bps = 9000 max_bps_base = {0: 9000}
min_bps = 300 min_bps = 300
max_total = -1 max_total = -1
@ -338,6 +346,15 @@ class devede_project:
surface = l[1] surface = l[1]
length = l[2] length = l[2]
audio_rate = l[3] audio_rate = l[3]
height = l[4]
max_bps = max_bps_base[0]
resy = 0
for bitrates in max_bps_base:
if (height >= bitrates) and (resy < bitrates):
resy = bitrates
max_bps = max_bps_base[bitrates]
video_rate = (remaining_disc_size * surface) / ( length * total_resolution) video_rate = (remaining_disc_size * surface) / ( length * total_resolution)
if max_total != -1: if max_total != -1:
max2 = max_total - audio_rate max2 = max_total - audio_rate