Allows to convert files (still incomplete)
This commit is contained in:
parent
e404f27e45
commit
4f42fb4dbd
8 changed files with 403 additions and 45 deletions
|
|
@ -31,13 +31,13 @@
|
||||||
</object>
|
</object>
|
||||||
<object class="GtkListStore" id="subtitles_list">
|
<object class="GtkListStore" id="subtitles_list">
|
||||||
<columns>
|
<columns>
|
||||||
<!-- column-name Subtitles file -->
|
<!-- column-name Subtitles -->
|
||||||
<column type="gchararray"/>
|
<column type="gchararray"/>
|
||||||
<!-- column-name Codepage -->
|
<!-- column-name Codepage -->
|
||||||
<column type="gchararray"/>
|
<column type="gchararray"/>
|
||||||
<!-- column-name Language -->
|
<!-- column-name Language -->
|
||||||
<column type="gchararray"/>
|
<column type="gchararray"/>
|
||||||
<!-- column-name Put upper -->
|
<!-- column-name Put -->
|
||||||
<column type="gboolean"/>
|
<column type="gboolean"/>
|
||||||
</columns>
|
</columns>
|
||||||
</object>
|
</object>
|
||||||
|
|
@ -1025,7 +1025,7 @@
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkRadioButton" id="size_720x480">
|
<object class="GtkRadioButton" id="size_720x480_ntsc">
|
||||||
<property name="label" translatable="yes">720x480</property>
|
<property name="label" translatable="yes">720x480</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
|
|
@ -1042,7 +1042,7 @@
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkRadioButton" id="size_704x480">
|
<object class="GtkRadioButton" id="size_704x480_ntsc">
|
||||||
<property name="label" translatable="yes">704x480</property>
|
<property name="label" translatable="yes">704x480</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
|
|
@ -1059,7 +1059,7 @@
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkRadioButton" id="size_480x480">
|
<object class="GtkRadioButton" id="size_480x480_ntsc">
|
||||||
<property name="label" translatable="yes">480x480</property>
|
<property name="label" translatable="yes">480x480</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
|
|
@ -1076,7 +1076,7 @@
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkRadioButton" id="size_352x480">
|
<object class="GtkRadioButton" id="size_352x480_ntsc">
|
||||||
<property name="label" translatable="yes">352x480</property>
|
<property name="label" translatable="yes">352x480</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
|
|
@ -1093,7 +1093,7 @@
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkRadioButton" id="size_352x240">
|
<object class="GtkRadioButton" id="size_352x240_ntsc">
|
||||||
<property name="label" translatable="yes">352x240</property>
|
<property name="label" translatable="yes">352x240</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
|
|
|
||||||
|
|
@ -26,9 +26,10 @@ class avconv_converter(devede.executor.executor):
|
||||||
|
|
||||||
supports_analize = False
|
supports_analize = False
|
||||||
supports_play = False
|
supports_play = False
|
||||||
supports_convert = False
|
supports_convert = True
|
||||||
supports_menu = True
|
supports_menu = True
|
||||||
display_name = "AVCONV"
|
display_name = "AVCONV"
|
||||||
|
disc_types = ["dvd","vcd","svcd","cvd","divx","mkv"]
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def check_is_installed():
|
def check_is_installed():
|
||||||
|
|
@ -44,10 +45,220 @@ class avconv_converter(devede.executor.executor):
|
||||||
devede.executor.executor.__init__(self)
|
devede.executor.executor.__init__(self)
|
||||||
self.config = devede.configuration_data.configuration.get_config()
|
self.config = devede.configuration_data.configuration.get_config()
|
||||||
|
|
||||||
def create_mpg(self,n_page,background_music,sound_length,pal,output_path):
|
def convert_file(self,file_project,output_file,video_length):
|
||||||
|
|
||||||
|
self.text = _("Converting %(X)s") % {"X" : file_project.title_name}
|
||||||
|
|
||||||
|
self.final_length = file_project.original_length
|
||||||
|
self.command_var=[]
|
||||||
|
self.command_var.append("avconv")
|
||||||
|
self.command_var.append("-i")
|
||||||
|
self.command_var.append(file_project.file_name)
|
||||||
|
|
||||||
|
if (file_project.volume!=100):
|
||||||
|
self.command_var.append("-vol")
|
||||||
|
self.command_var.append(str((256*file_project.volume)/100))
|
||||||
|
|
||||||
|
if (file_project.audio_delay!=0.0) and (file_project.copy_sound==False) and (file_project.no_reencode_audio_video==False):
|
||||||
|
self.command_var.append("-itsoffset")
|
||||||
|
self.command_var.append(str(file_project.audio_delay))
|
||||||
|
self.command_var.append("-i")
|
||||||
|
self.command_var.append(file_project.file_name)
|
||||||
|
self.command_var.append("-map")
|
||||||
|
self.command_var.append("1:0")
|
||||||
|
for l in range (file_project.audio_streams):
|
||||||
|
self.command_var.append("-map")
|
||||||
|
self.command_var.append("0"+":"+str(l+1))
|
||||||
|
|
||||||
|
if (file_project.no_reencode_audio_video==False):
|
||||||
|
cmd_line=""
|
||||||
|
|
||||||
|
if file_project.deinterlace=="deinterlace_yadif":
|
||||||
|
cmd_line+="yadif"
|
||||||
|
|
||||||
|
vflip=False
|
||||||
|
hflip=False
|
||||||
|
|
||||||
|
if (file_project.rotation=="rotation_90"):
|
||||||
|
if (cmd_line!=""):
|
||||||
|
cmd_line+=",fifo,"
|
||||||
|
cmd_line+="transpose=1"
|
||||||
|
elif (file_project.rotation=="rotation_270"):
|
||||||
|
if (cmd_line!=""):
|
||||||
|
cmd_line+=",fifo,"
|
||||||
|
cmd_line+="transpose=2"
|
||||||
|
elif (file_project.rotation=="rotation_180"):
|
||||||
|
vflip=True
|
||||||
|
hflip=True
|
||||||
|
|
||||||
|
if (file_project.mirror_vertical):
|
||||||
|
vflip=not vflip
|
||||||
|
if (file_project.mirror_horizontal):
|
||||||
|
hflip=not hflip
|
||||||
|
|
||||||
|
if (vflip):
|
||||||
|
if (cmd_line!=""):
|
||||||
|
cmd_line+=",fifo,"
|
||||||
|
cmd_line+="vflip"
|
||||||
|
if (hflip):
|
||||||
|
if (cmd_line!=""):
|
||||||
|
cmd_line+=",fifo,"
|
||||||
|
cmd_line+="hflip"
|
||||||
|
|
||||||
|
# if addbars and ((resx_inter!=resx_original) or (resy_inter!=resy_original)) and (default_res==False):
|
||||||
|
# if (cmd_line!=""):
|
||||||
|
# cmd_line+=",fifo,"
|
||||||
|
# cmd_line+="scale="+str(resx_inter)+":"+str(resy_inter)+",fifo,pad="+str(resx_final)+":"+str(resy_final)+":"+str(addx)+":"+str(addy)+":0x000000"
|
||||||
|
|
||||||
|
if cmd_line!="":
|
||||||
|
self.command_var.append("-vf")
|
||||||
|
self.command_var.append(cmd_line)
|
||||||
|
|
||||||
|
|
||||||
|
self.command_var.append("-y")
|
||||||
|
|
||||||
|
vcd=False
|
||||||
|
|
||||||
|
if (self.config.disc_type!="divx"):
|
||||||
|
self.command_var.append("-target")
|
||||||
|
if (self.config.disc_type=="dvd"):
|
||||||
|
if not file_project.format_pal:
|
||||||
|
self.command_var.append("ntsc-dvd")
|
||||||
|
elif (file_project.original_fps==24):
|
||||||
|
self.command_var.append("film-dvd")
|
||||||
|
else:
|
||||||
|
self.command_var.append("pal-dvd")
|
||||||
|
if (not file_project.copy_sound):
|
||||||
|
self.command_var.append("-acodec")
|
||||||
|
self.command_var.append("ac3")
|
||||||
|
elif (self.config.disc_type=="vcd"):
|
||||||
|
vcd=True
|
||||||
|
if not file_project.format_pal:
|
||||||
|
self.command_var.append("ntsc-vcd")
|
||||||
|
else:
|
||||||
|
self.command_var.append("pal-vcd")
|
||||||
|
elif (self.config.disc_type=="svcd"):
|
||||||
|
if not file_project.format_pal:
|
||||||
|
self.command_var.append("ntsc-svcd")
|
||||||
|
else:
|
||||||
|
self.command_var.append("pal-svcd")
|
||||||
|
elif (self.config.disc_type=="cvd"):
|
||||||
|
if not file_project.format_pal:
|
||||||
|
self.command_var.append("ntsc-svcd")
|
||||||
|
else:
|
||||||
|
self.command_var.append("pal-svcd")
|
||||||
|
else: # DivX
|
||||||
|
self.command_var.append("-vcodec")
|
||||||
|
self.command_var.append("mpeg4")
|
||||||
|
self.command_var.append("-acodec")
|
||||||
|
self.command_var.append("libmp3lame")
|
||||||
|
self.command_var.append("-f")
|
||||||
|
self.command_var.append("avi")
|
||||||
|
|
||||||
|
if (not file_project.no_reencode_audio_video):
|
||||||
|
self.command_var.append("-sn") # no subtitles
|
||||||
|
|
||||||
|
if file_project.copy_sound or file_project.no_reencode_audio_video:
|
||||||
|
self.command_var.append("-acodec")
|
||||||
|
self.command_var.append("copy")
|
||||||
|
#else:
|
||||||
|
# if (self.config.disc_type=="divx"):
|
||||||
|
# self.command_var.append("-acodec")
|
||||||
|
# self.command_var.append("mp3")
|
||||||
|
|
||||||
|
#if (audiostream!=10000):
|
||||||
|
# self.command_var.append("-aid")
|
||||||
|
# self.command_var.append(str(audiostream))
|
||||||
|
|
||||||
|
if file_project.no_reencode_audio_video:
|
||||||
|
self.command_var.append("-vcodec")
|
||||||
|
self.command_var.append("copy")
|
||||||
|
|
||||||
|
if (vcd==False):
|
||||||
|
if not file_project.format_pal:
|
||||||
|
if (file_project.original_fps==24) and ((self.config.disc_type=="dvd") or (self.config.disc_type=="divx")):
|
||||||
|
str_final_framerate="24000/1001"
|
||||||
|
keyintv=15
|
||||||
|
telecine=True
|
||||||
|
else:
|
||||||
|
str_final_framerate="30000/1001"
|
||||||
|
keyintv=18
|
||||||
|
else:
|
||||||
|
str_final_framerate="25"
|
||||||
|
keyintv=15
|
||||||
|
if not file_project.gop12:
|
||||||
|
self.command_var.append("-g")
|
||||||
|
self.command_var.append(str(keyintv))
|
||||||
|
|
||||||
|
if (self.config.disc_type=="divx"):
|
||||||
|
self.command_var.append("-g")
|
||||||
|
self.command_var.append("300")
|
||||||
|
elif file_project.gop12 and (file_project.no_reencode_audio_video==False):
|
||||||
|
self.command_var.append("-g")
|
||||||
|
self.command_var.append("12")
|
||||||
|
|
||||||
|
self.command_var.append("-bf")
|
||||||
|
self.command_var.append("2")
|
||||||
|
self.command_var.append("-strict")
|
||||||
|
self.command_var.append("1")
|
||||||
|
|
||||||
|
if video_length != 0:
|
||||||
|
self.command_var.append("-t")
|
||||||
|
self.command_var.append(str(video_length))
|
||||||
|
# else:
|
||||||
|
# if videofile["cutting"]==1: # first half only
|
||||||
|
# self.command_var.append("-t")
|
||||||
|
# self.command_var.append(str(videofile["olength"]/2))
|
||||||
|
# elif videofile["cutting"]==2: # second half only
|
||||||
|
# self.command_var.append("-ss")
|
||||||
|
# self.command_var.append(str((videofile["olength"]/2)-5)) # start 5 seconds before
|
||||||
|
|
||||||
|
#if (audiodelay!=0.0) and (copy_audio==False) and (isvob==False):
|
||||||
|
# self.command_var.append("-delay")
|
||||||
|
# self.command_var.append(str(audiodelay))
|
||||||
|
|
||||||
|
self.command_var.append("-ac")
|
||||||
|
if (file_project.sound5_1) and ((self.config.disc_type=="dvd") or (self.config.disc_type=="divx")):
|
||||||
|
self.command_var.append("6")
|
||||||
|
else:
|
||||||
|
self.command_var.append("2")
|
||||||
|
|
||||||
|
#if (isvob==False) and (default_res==False):
|
||||||
|
# self.command_var.append("-ofps")
|
||||||
|
# self.command_var.append(str_final_framerate)
|
||||||
|
|
||||||
|
if self.config.disc_type=="divx":
|
||||||
|
self.command_var.append("-vtag")
|
||||||
|
self.command_var.append("DX50")
|
||||||
|
|
||||||
|
if (file_project.deinterlace == "deinterlace_ffmpeg") and (file_project.no_reencode_audio_video==False):
|
||||||
|
self.command_var.append("-deinterlace")
|
||||||
|
|
||||||
|
if (file_project.no_reencode_audio_video==False) and (vcd==False):
|
||||||
|
self.command_var.append("-s")
|
||||||
|
self.command_var.append(str(file_project.width_final)+"x"+str(file_project.height_final))
|
||||||
|
|
||||||
|
self.command_var.append("-trellis")
|
||||||
|
self.command_var.append("1")
|
||||||
|
|
||||||
|
self.command_var.append("-mbd")
|
||||||
|
self.command_var.append("2")
|
||||||
|
|
||||||
|
if (vcd == False) and (file_project.no_reencode_audio_video == False):
|
||||||
|
self.command_var.append("-b:a")
|
||||||
|
self.command_var.append(str(file_project.audio_rate_final)+"k")
|
||||||
|
|
||||||
|
self.command_var.append("-b:v")
|
||||||
|
self.command_var.append(str(file_project.video_rate_final)+"k")
|
||||||
|
|
||||||
|
self.command_var.append(output_file)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def create_menu_mpeg(self,n_page,background_music,sound_length,pal,output_path):
|
||||||
|
|
||||||
self.n_page = n_page
|
self.n_page = n_page
|
||||||
self.sound_length = float(sound_length)
|
self.final_length = float(sound_length)
|
||||||
self.text = _("Creating menu %(X)d") % {"X": self.n_page}
|
self.text = _("Creating menu %(X)d") % {"X": self.n_page}
|
||||||
|
|
||||||
self.command_var=[]
|
self.command_var=[]
|
||||||
|
|
@ -102,4 +313,4 @@ class avconv_converter(devede.executor.executor):
|
||||||
pos2 = data[0].find(" ",pos)
|
pos2 = data[0].find(" ",pos)
|
||||||
if (pos2 != -1):
|
if (pos2 != -1):
|
||||||
t = float(data[0][pos:pos2])
|
t = float(data[0][pos:pos2])
|
||||||
self.progress_bar[1].set_fraction(t / self.sound_length)
|
self.progress_bar[1].set_fraction(t / self.final_length)
|
||||||
|
|
@ -44,6 +44,7 @@ class converter:
|
||||||
self.default_converter = None
|
self.default_converter = None
|
||||||
self.menuers = {}
|
self.menuers = {}
|
||||||
self.default_menuer = None
|
self.default_menuer = None
|
||||||
|
self.discs = []
|
||||||
|
|
||||||
for element in self.c:
|
for element in self.c:
|
||||||
if (element.check_is_installed() == False):
|
if (element.check_is_installed() == False):
|
||||||
|
|
@ -61,6 +62,9 @@ class converter:
|
||||||
self.converters[name] = element
|
self.converters[name] = element
|
||||||
if (self.default_converter == None):
|
if (self.default_converter == None):
|
||||||
self.default_converter = element
|
self.default_converter = element
|
||||||
|
for types in element.disc_types:
|
||||||
|
if self.discs.count(types) == 0:
|
||||||
|
self.discs.append(types)
|
||||||
if (element.supports_menu):
|
if (element.supports_menu):
|
||||||
self.menuers[name] = element
|
self.menuers[name] = element
|
||||||
if (self.default_menuer == None):
|
if (self.default_menuer == None):
|
||||||
|
|
@ -120,4 +124,12 @@ class converter:
|
||||||
if (self.config.menu_converter == None) or (self.analizers.has_key(self.config.menu_converter) == False):
|
if (self.config.menu_converter == None) or (self.analizers.has_key(self.config.menu_converter) == False):
|
||||||
return self.default_menuer
|
return self.default_menuer
|
||||||
else:
|
else:
|
||||||
return self.menuers[self.config.menu_converter]
|
return self.menuers[self.config.menu_converter]
|
||||||
|
|
||||||
|
def get_disc_converter(self):
|
||||||
|
""" returns a class for the desired disc converter, or the most priviledged if the desired is not installed """
|
||||||
|
|
||||||
|
if (self.config.film_converter == None) or (self.analizers.has_key(self.config.film_converter) == False):
|
||||||
|
return self.default_converter
|
||||||
|
else:
|
||||||
|
return self.converters[self.config.film_converter]
|
||||||
|
|
@ -540,7 +540,7 @@ class dvd_menu(devede.interface_manager.interface_manager):
|
||||||
self.sf.write_to_png(os.path.join(menu_folder,"menu_"+str(n_page)+"_active_bg.png"))
|
self.sf.write_to_png(os.path.join(menu_folder,"menu_"+str(n_page)+"_active_bg.png"))
|
||||||
self.create_menu_stream(menu_folder, n_page, coordinates)
|
self.create_menu_stream(menu_folder, n_page, coordinates)
|
||||||
converter = menu_converter()
|
converter = menu_converter()
|
||||||
converter.create_mpg(n_page,self.background_music,self.sound_length,self.config.PAL,menu_folder)
|
converter.create_menu_mpeg(n_page,self.background_music,self.sound_length,self.config.PAL,menu_folder)
|
||||||
# add this process without dependencies
|
# add this process without dependencies
|
||||||
processes.append([converter, None])
|
processes.append([converter, None])
|
||||||
muxer = devede.mux_dvd_menu.mux_dvd_menu()
|
muxer = devede.mux_dvd_menu.mux_dvd_menu()
|
||||||
|
|
|
||||||
|
|
@ -83,6 +83,8 @@ class executor(GObject.GObject):
|
||||||
for e in command:
|
for e in command:
|
||||||
self.launch_command += (e+" ")
|
self.launch_command += (e+" ")
|
||||||
|
|
||||||
|
print(self.launch_command)
|
||||||
|
|
||||||
if (self.stdin_file != None):
|
if (self.stdin_file != None):
|
||||||
self.handle = subprocess.Popen(command,stdin = subprocess.PIPE, stdout = subprocess.PIPE, stderr = subprocess.PIPE)
|
self.handle = subprocess.Popen(command,stdin = subprocess.PIPE, stdout = subprocess.PIPE, stderr = subprocess.PIPE)
|
||||||
self.channel_stdin = GLib.IOChannel(self.handle.stdin.fileno())
|
self.channel_stdin = GLib.IOChannel(self.handle.stdin.fileno())
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,7 @@ class file_movie(devede.interface_manager.interface_manager):
|
||||||
self.add_toggle("gop12", True)
|
self.add_toggle("gop12", True)
|
||||||
|
|
||||||
self.add_group("final_size_pal", ["size_auto", "size_1920x1080", "size_1280x720", "size_720x576", "size_704x576", "size_480x576","size_352x576", "size_352x288"], "size_auto")
|
self.add_group("final_size_pal", ["size_auto", "size_1920x1080", "size_1280x720", "size_720x576", "size_704x576", "size_480x576","size_352x576", "size_352x288"], "size_auto")
|
||||||
self.add_group("final_size_ntsc", ["size_auto_ntsc", "size_1920x1080_ntsc", "size_1280x720_ntsc", "size_720x480", "size_704x480", "size_480x480","size_352x480", "size_352x240"], "size_auto_ntsc")
|
self.add_group("final_size_ntsc", ["size_auto_ntsc", "size_1920x1080_ntsc", "size_1280x720_ntsc", "size_720x480_ntsc", "size_704x480_ntsc", "size_480x480_ntsc","size_352x480_ntsc", "size_352x240_ntsc"], "size_auto_ntsc")
|
||||||
self.add_group("aspect_ratio", ["aspect_auto", "aspect_classic", "aspect_wide"], "aspect_auto")
|
self.add_group("aspect_ratio", ["aspect_auto", "aspect_classic", "aspect_wide"], "aspect_auto")
|
||||||
self.add_group("scaling", ["add_black_bars", "scale_picture" ,"cut_picture"], "add_black_bars")
|
self.add_group("scaling", ["add_black_bars", "scale_picture" ,"cut_picture"], "add_black_bars")
|
||||||
self.add_group("rotation",["rotation_0","rotation_90","rotation_180","rotation_270"], "rotation_0")
|
self.add_group("rotation",["rotation_0","rotation_90","rotation_180","rotation_270"], "rotation_0")
|
||||||
|
|
@ -97,7 +97,7 @@ class file_movie(devede.interface_manager.interface_manager):
|
||||||
|
|
||||||
common_elements = ["gop12","video_rate_automatic","video_spinbutton","audio_rate_automatic","audio_spinbutton","format_pal","format_ntsc","spinbutton_volume","scale_volume","reset_volume",
|
common_elements = ["gop12","video_rate_automatic","video_spinbutton","audio_rate_automatic","audio_spinbutton","format_pal","format_ntsc","spinbutton_volume","scale_volume","reset_volume",
|
||||||
"size_auto", "size_1920x1080", "size_1280x720", "size_720x576", "size_704x576", "size_480x576","size_352x576", "size_352x288",
|
"size_auto", "size_1920x1080", "size_1280x720", "size_720x576", "size_704x576", "size_480x576","size_352x576", "size_352x288",
|
||||||
"size_auto_ntsc", "size_1920x1080_ntsc", "size_1280x720_ntsc", "size_720x480", "size_704x480", "size_480x480","size_352x480", "size_352x240",
|
"size_auto_ntsc", "size_1920x1080_ntsc", "size_1280x720_ntsc", "size_720x480_ntsc", "size_704x480_ntsc", "size_480x480_ntsc","size_352x480_ntsc", "size_352x240_ntsc",
|
||||||
"aspect_auto","aspect_classic","aspect_wide","mirror_horizontal","mirror_vertical","add_black_bars","scale_picture","cut_picture",
|
"aspect_auto","aspect_classic","aspect_wide","mirror_horizontal","mirror_vertical","add_black_bars","scale_picture","cut_picture",
|
||||||
"rotation_0","rotation_90","rotation_180","rotation_270","two_pass_encoding","deinterlace_none","deinterlace_ffmpeg","deinterlace_yadif",
|
"rotation_0","rotation_90","rotation_180","rotation_270","two_pass_encoding","deinterlace_none","deinterlace_ffmpeg","deinterlace_yadif",
|
||||||
"audio_delay_spinbutton","sound5_1","copy_sound"]
|
"audio_delay_spinbutton","sound5_1","copy_sound"]
|
||||||
|
|
@ -133,37 +133,147 @@ class file_movie(devede.interface_manager.interface_manager):
|
||||||
self.original_fps = film_analizer.original_fps
|
self.original_fps = film_analizer.original_fps
|
||||||
self.error = False
|
self.error = False
|
||||||
|
|
||||||
|
self.width_midle = -1
|
||||||
|
self.height_midle = -1
|
||||||
|
self.width_final = -1
|
||||||
|
self.height_final = -1
|
||||||
|
self.video_rate_final = self.video_rate
|
||||||
|
self.audio_rate_final = self.audio_rate
|
||||||
|
self.aspect_ratio_final = None
|
||||||
|
|
||||||
|
def get_max_resolution(self,rx,ry,aspect):
|
||||||
|
|
||||||
|
tmpx = ry*aspect
|
||||||
|
tmpy = rx/aspect
|
||||||
|
if (tmpx > rx):
|
||||||
|
return tmpx,ry
|
||||||
|
else:
|
||||||
|
return rx,tmpy
|
||||||
|
|
||||||
|
def set_final_size_aspect(self):
|
||||||
|
|
||||||
|
if self.format_pal:
|
||||||
|
final_size = self.final_size_pal
|
||||||
|
else:
|
||||||
|
final_size = self.final_size_ntsc[:-5] # remove the "_ntsc" from the string
|
||||||
|
|
||||||
|
# for divx or matroska, if the size and the aspect ratio is automatic, just don't change them
|
||||||
|
if ((self.disc_type == "divx") or (self.disc_type == "mkv")) and (final_size == "size_auto") and (self.aspect_ratio == "aspect_auto"):
|
||||||
|
self.width_midle = self.original_width
|
||||||
|
self.width_final = self.original_width
|
||||||
|
self.height_midle = self.original_height
|
||||||
|
self.height_final = self.original_height
|
||||||
|
self.aspect_ratio_final = self.original_aspect_ratio
|
||||||
|
return
|
||||||
|
|
||||||
|
# The steps are:
|
||||||
|
# - Decide the final aspect ratio
|
||||||
|
# - Calculate the midle size: the original video will be scaled to this size
|
||||||
|
# - Calculate the final size: the midle video will be cut to this size, or black bars will be added
|
||||||
|
|
||||||
|
aspect_wide = False
|
||||||
|
# first, decide the final aspect ratio
|
||||||
|
if (self.disc_type == "vcd") or (self.disc_type == "svcd") or (self.disc_type == "cvd"):
|
||||||
|
self.aspect_ratio_final = 4.0/3.0
|
||||||
|
else:
|
||||||
|
if (self.aspect_ratio == "aspect_auto"):
|
||||||
|
if (self.disc_type != "dvd"):
|
||||||
|
self.aspect_ratio_final = self.original_aspect_ratio
|
||||||
|
else:
|
||||||
|
if self.original_aspect_ratio >= 1.7:
|
||||||
|
self.aspect_ratio_final = 16.0/9.0
|
||||||
|
aspect_wide = True
|
||||||
|
else:
|
||||||
|
self.aspect_ratio_final = 4.0/3.0
|
||||||
|
elif (self.aspect_ratio == "aspect_classic"):
|
||||||
|
self.aspect_ratio_final = 4.0/3.0
|
||||||
|
else:
|
||||||
|
self.aspect_ratio_final = 16.0/9.0
|
||||||
|
aspect_wide = True
|
||||||
|
|
||||||
|
# now, the final resolution
|
||||||
|
if self.disc_type == "vcd":
|
||||||
|
self.width_final = 352
|
||||||
|
if (self.format_pal):
|
||||||
|
self.height_final = 288
|
||||||
|
else:
|
||||||
|
self.height_final = 240
|
||||||
|
else:
|
||||||
|
if final_size == "size_auto":
|
||||||
|
if self.disc_type == "svcd":
|
||||||
|
self.width_final =480
|
||||||
|
if (self.format_pal):
|
||||||
|
self.height_final = 576
|
||||||
|
else:
|
||||||
|
self.height_final = 480
|
||||||
|
elif self.disc_type == "cvd":
|
||||||
|
self.width_final =352
|
||||||
|
if (self.format_pal):
|
||||||
|
self.height_final = 288
|
||||||
|
else:
|
||||||
|
self.height_final = 240
|
||||||
|
elif self.disc_type == "dvd":
|
||||||
|
if aspect_wide:
|
||||||
|
self.width_final = 720
|
||||||
|
if (self.format_pal):
|
||||||
|
self.height_final = 576
|
||||||
|
else:
|
||||||
|
self.height_final = 480
|
||||||
|
else:
|
||||||
|
tx, ty = self.get_max_resolution(self.original_width,self.original_height,self.original_aspect_ratio)
|
||||||
|
if (self.format_pal):
|
||||||
|
th = 576
|
||||||
|
th2 = 288
|
||||||
|
else:
|
||||||
|
th = 480
|
||||||
|
th2 = 240
|
||||||
|
if ( tx <= 352 ) and (ty <= th2):
|
||||||
|
self.width_final = 352
|
||||||
|
self.height_final = th2
|
||||||
|
elif (tx <= 352) and (ty <= th):
|
||||||
|
self.width_final = 352
|
||||||
|
self.height_final = th
|
||||||
|
elif (tx <= 704) and (ty <= th):
|
||||||
|
self.width_final = 704
|
||||||
|
self.height_final = th
|
||||||
|
else:
|
||||||
|
self.width_final = 720
|
||||||
|
self.height_final = th
|
||||||
|
else:
|
||||||
|
self.width_final , self.height_final = self.get_max_resolution(self.original_width,self.original_height,self.original_aspect_ratio)
|
||||||
|
else:
|
||||||
|
values = final_size[5:].split("x")
|
||||||
|
self.width_final = int(values[0])
|
||||||
|
self.height_final = int(values[1])
|
||||||
|
|
||||||
|
# finally, calculate the midle size
|
||||||
|
|
||||||
|
if (self.rotation == "rotation_90") or (self.rotation == "rotation_270"):
|
||||||
|
midle_aspect_ratio = 1.0 / self.original_aspect_ratio
|
||||||
|
else:
|
||||||
|
midle_aspect_ratio = self.original_aspect_ratio
|
||||||
|
|
||||||
|
if self.scaling == "scale_picture":
|
||||||
|
self.width_midle = self.width_final
|
||||||
|
self.height_midle = self.height_final
|
||||||
|
elif self.scaling == "add_black_bars":
|
||||||
|
if midle_aspect_ratio > self.aspect_ratio_final: # add horizontal black bars, at top and bottom
|
||||||
|
self.width_midle = self.width_final
|
||||||
|
self.height_midle = self.height_final * self.aspect_ratio_final / midle_aspect_ratio
|
||||||
|
else: # add vertical black bars, at left and right
|
||||||
|
self.width_midle = self.height_final * midle_aspect_ratio
|
||||||
|
self.height_midle = self.original_height
|
||||||
|
else: # cut picture
|
||||||
|
#if midle_aspect_ratio > self.aspect_ratio_final: # add horizontal black bars, at top and bottom
|
||||||
|
self.width_midle = self.width_final
|
||||||
|
self.height_midle = self.height_final # temporal option, until I do the calculations
|
||||||
|
|
||||||
|
|
||||||
def set_type(self,obj = None,disc_type = None):
|
def set_type(self,obj = None,disc_type = None):
|
||||||
|
|
||||||
if (disc_type != None):
|
if (disc_type != None):
|
||||||
self.disc_type = disc_type
|
self.disc_type = disc_type
|
||||||
|
|
||||||
if (disc_type == "vcd"):
|
|
||||||
self.final_size_auto_width = 352
|
|
||||||
self.final_size_auto_height_pal = 288
|
|
||||||
self.final_size_auto_height_ntsc = 240
|
|
||||||
self.video_rate_auto_value = 1152
|
|
||||||
self.audio_rate_auto_value = 224
|
|
||||||
elif (disc_type == "svcd"):
|
|
||||||
self.final_size_auto_width = 480
|
|
||||||
self.final_size_auto_height_pal = 576
|
|
||||||
self.final_size_auto_height_ntsc = 480
|
|
||||||
self.video_rate_auto_value = -1
|
|
||||||
self.audio_rate_auto_value = -1
|
|
||||||
elif (disc_type == "cvd"):
|
|
||||||
self.final_size_auto_width = 352
|
|
||||||
self.final_size_auto_height_pal = 576
|
|
||||||
self.final_size_auto_height_ntsc = 480
|
|
||||||
self.video_rate_auto_value = -1
|
|
||||||
self.audio_rate_auto_value = -1
|
|
||||||
else: # dvd, divx and mkv
|
|
||||||
self.final_size_auto_width = -1
|
|
||||||
self.final_size_auto_height_pal = -1
|
|
||||||
self.final_size_auto_height_ntsc = -1
|
|
||||||
self.video_rate_auto_value = -1
|
|
||||||
self.audio_rate_auto_value = -1
|
|
||||||
|
|
||||||
|
|
||||||
def delete_file(self):
|
def delete_file(self):
|
||||||
|
|
||||||
|
|
@ -320,4 +430,16 @@ class file_movie(devede.interface_manager.interface_manager):
|
||||||
if (model == None):
|
if (model == None):
|
||||||
self.wdel_subtitles.set_sensitive(False)
|
self.wdel_subtitles.set_sensitive(False)
|
||||||
else:
|
else:
|
||||||
self.wdel_subtitles.set_sensitive(True)
|
self.wdel_subtitles.set_sensitive(True)
|
||||||
|
|
||||||
|
|
||||||
|
def do_conversion(self, output_path, duration = 0):
|
||||||
|
|
||||||
|
self.set_final_size_aspect()
|
||||||
|
p = []
|
||||||
|
cv = devede.converter.converter()
|
||||||
|
disc_converter = cv.get_disc_converter()
|
||||||
|
converter = disc_converter()
|
||||||
|
converter.convert_file(self,output_path,duration)
|
||||||
|
p.append([converter, None])
|
||||||
|
return p
|
||||||
|
|
@ -177,6 +177,7 @@ class devede_project:
|
||||||
|
|
||||||
ask = devede.ask.ask_window()
|
ask = devede.ask.ask_window()
|
||||||
if (ask.run(_("Abort the current DVD and exit?"),_("Exit DeVeDe"))):
|
if (ask.run(_("Abort the current DVD and exit?"),_("Exit DeVeDe"))):
|
||||||
|
print(self.config.get_log())
|
||||||
Gtk.main_quit()
|
Gtk.main_quit()
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
@ -261,7 +262,17 @@ class devede_project:
|
||||||
return
|
return
|
||||||
|
|
||||||
run_window = devede.runner.runner()
|
run_window = devede.runner.runner()
|
||||||
|
file_movies = self.get_all_files()
|
||||||
p = self.menu.create_dvd_menus(self.get_all_files(), data.path)
|
p = self.menu.create_dvd_menus(file_movies, data.path)
|
||||||
run_window.add_processes(p)
|
run_window.add_processes(p)
|
||||||
|
movie_folder = os.path.join(data.path,"movies")
|
||||||
|
try:
|
||||||
|
os.makedirs(movie_folder)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
counter = 0
|
||||||
|
for movie in file_movies:
|
||||||
|
p = movie.do_conversion(os.path.join(movie_folder,"movie_"+str(counter)+".mpg"))
|
||||||
|
run_window.add_processes(p)
|
||||||
|
counter += 1
|
||||||
run_window.run()
|
run_window.run()
|
||||||
|
|
@ -56,7 +56,7 @@ class runner(GObject.GObject):
|
||||||
self.progress_bars.append([f, p, None])
|
self.progress_bars.append([f, p, None])
|
||||||
box.pack_start(f,True,True,0)
|
box.pack_start(f,True,True,0)
|
||||||
box.set_orientation(Gtk.Orientation.VERTICAL)
|
box.set_orientation(Gtk.Orientation.VERTICAL)
|
||||||
self.total = 0
|
self.total_processes = 0
|
||||||
|
|
||||||
def add_processes(self,processes):
|
def add_processes(self,processes):
|
||||||
for p in processes:
|
for p in processes:
|
||||||
|
|
@ -94,7 +94,7 @@ class runner(GObject.GObject):
|
||||||
else:
|
else:
|
||||||
self.progress_bars = []
|
self.progress_bars = []
|
||||||
break
|
break
|
||||||
self.wtotal.set_text(str(len(self.proc_list)-self.total)+"/"+str(self.total))
|
self.wtotal.set_text(str(self.total_processes - len(self.proc_list))+"/"+str(self.total_processes))
|
||||||
|
|
||||||
def process_ended(self,process, retval):
|
def process_ended(self,process, retval):
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue