Now uses the right minimum and maximum bitrate
Now sets the right file extension with Matroska and DivX files
This commit is contained in:
parent
c3f8d3531d
commit
27828d2dc5
9 changed files with 987 additions and 928 deletions
|
|
@ -1,4 +1,8 @@
|
||||||
## History of versions ##
|
## History of versions ##
|
||||||
|
* version 4.8.6 (2016-12-14)
|
||||||
|
* Now ensures that the average bitrate is never smaller than the minimum bitrate
|
||||||
|
* Now the matroska and divx files have the right extension
|
||||||
|
|
||||||
* version 4.8.5 (2016-11-24)
|
* version 4.8.5 (2016-11-24)
|
||||||
* Fixed a bug when loading a project file (thanks to RecursiveProgrammer)
|
* Fixed a bug when loading a project file (thanks to RecursiveProgrammer)
|
||||||
* Updated the german translation
|
* Updated the german translation
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!-- Generated with glade 3.18.3 -->
|
<!-- Generated with glade 3.20.0 -->
|
||||||
<interface>
|
<interface>
|
||||||
<requires lib="gtk+" version="3.10"/>
|
<requires lib="gtk+" version="3.10"/>
|
||||||
<object class="GtkDialog" id="dialog_create">
|
<object class="GtkDialog" id="dialog_create">
|
||||||
|
|
@ -62,9 +62,11 @@
|
||||||
<property name="orientation">vertical</property>
|
<property name="orientation">vertical</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkLabel" id="label1">
|
<object class="GtkLabel" id="label1">
|
||||||
|
<property name="width_request">380</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="label" translatable="yes">Choose the folder where Devede will create the files and a name for it. Do not use a folder in a VFAT/FAT32 drive. Characters /, | and \ are not accepted and will be replaced by underscores.</property>
|
<property name="label" translatable="yes">Choose the folder where Devede will create the files and a name for it. Do not use a folder in a VFAT/FAT32 drive. Characters /, | and \ are not accepted and will be replaced by underscores.</property>
|
||||||
|
<property name="justify">fill</property>
|
||||||
<property name="wrap">True</property>
|
<property name="wrap">True</property>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@
|
||||||
<object class="GtkDialog" id="done">
|
<object class="GtkDialog" id="done">
|
||||||
<property name="width_request">640</property>
|
<property name="width_request">640</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
|
<property name="resizable">False</property>
|
||||||
<property name="type_hint">dialog</property>
|
<property name="type_hint">dialog</property>
|
||||||
<child internal-child="vbox">
|
<child internal-child="vbox">
|
||||||
<object class="GtkBox" id="dialog-vbox1">
|
<object class="GtkBox" id="dialog-vbox1">
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@
|
||||||
<object class="GtkDialog" id="dialog_error">
|
<object class="GtkDialog" id="dialog_error">
|
||||||
<property name="width_request">640</property>
|
<property name="width_request">640</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
|
<property name="resizable">False</property>
|
||||||
<property name="modal">True</property>
|
<property name="modal">True</property>
|
||||||
<property name="window_position">center</property>
|
<property name="window_position">center</property>
|
||||||
<property name="type_hint">dialog</property>
|
<property name="type_hint">dialog</property>
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!-- Generated with glade 3.16.1 -->
|
<!-- Generated with glade 3.20.0 -->
|
||||||
<interface>
|
<interface>
|
||||||
<requires lib="gtk+" version="3.10"/>
|
<requires lib="gtk+" version="3.10"/>
|
||||||
<object class="GtkListStore" id="liststore_elements">
|
<object class="GtkListStore" id="liststore_elements">
|
||||||
|
|
@ -12,6 +12,7 @@
|
||||||
<property name="width_request">480</property>
|
<property name="width_request">480</property>
|
||||||
<property name="height_request">360</property>
|
<property name="height_request">360</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
|
<property name="resizable">False</property>
|
||||||
<property name="modal">True</property>
|
<property name="modal">True</property>
|
||||||
<property name="window_position">center</property>
|
<property name="window_position">center</property>
|
||||||
<property name="type_hint">dialog</property>
|
<property name="type_hint">dialog</property>
|
||||||
|
|
@ -56,6 +57,7 @@
|
||||||
<object class="GtkLabel" id="label_message">
|
<object class="GtkLabel" id="label_message">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
|
<property name="justify">fill</property>
|
||||||
<property name="wrap">True</property>
|
<property name="wrap">True</property>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
|
|
|
||||||
2
setup.py
2
setup.py
|
|
@ -64,7 +64,7 @@ except:
|
||||||
setup(
|
setup(
|
||||||
name='devedeng',
|
name='devedeng',
|
||||||
|
|
||||||
version='4.8.5',
|
version='4.8.6',
|
||||||
|
|
||||||
description='A video DVD creator',
|
description='A video DVD creator',
|
||||||
long_description = "A program that allows to create video DVDs",
|
long_description = "A program that allows to create video DVDs",
|
||||||
|
|
|
||||||
|
|
@ -25,524 +25,535 @@ import devedeng.mux_dvd_menu
|
||||||
|
|
||||||
class avconv(devedeng.avbase.avbase):
|
class avconv(devedeng.avbase.avbase):
|
||||||
|
|
||||||
supports_analize = False
|
supports_analize = False
|
||||||
supports_play = False
|
supports_play = False
|
||||||
supports_convert = True
|
supports_convert = True
|
||||||
supports_menu = True
|
supports_menu = True
|
||||||
supports_mkiso = False
|
supports_mkiso = False
|
||||||
supports_burn = False
|
supports_burn = False
|
||||||
display_name = "AVCONV"
|
display_name = "AVCONV"
|
||||||
disc_types = []
|
disc_types = []
|
||||||
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def check_is_installed():
|
def check_is_installed():
|
||||||
try:
|
try:
|
||||||
handle = subprocess.Popen(["avconv","-codecs"], stdout = subprocess.PIPE, stderr = subprocess.PIPE)
|
handle = subprocess.Popen(["avconv","-codecs"], stdout = subprocess.PIPE, stderr = subprocess.PIPE)
|
||||||
(stdout, stderr) = handle.communicate()
|
(stdout, stderr) = handle.communicate()
|
||||||
if 0==handle.wait():
|
if 0==handle.wait():
|
||||||
mp2 = False
|
mp2 = False
|
||||||
mp3 = False
|
mp3 = False
|
||||||
ac3 = False
|
ac3 = False
|
||||||
mpeg1 = False
|
mpeg1 = False
|
||||||
mpeg2 = False
|
mpeg2 = False
|
||||||
divx = False
|
divx = False
|
||||||
h264 = False
|
h264 = False
|
||||||
for line in stdout.decode("latin-1").split("\n"):
|
for line in stdout.decode("latin-1").split("\n"):
|
||||||
parts = line.strip().split(" ")
|
parts = line.strip().split(" ")
|
||||||
if len(parts) < 2:
|
if len(parts) < 2:
|
||||||
continue
|
continue
|
||||||
if len(parts[0]) != 6:
|
if len(parts[0]) != 6:
|
||||||
continue
|
continue
|
||||||
capabilities = parts[0]
|
capabilities = parts[0]
|
||||||
codec = parts[1]
|
codec = parts[1]
|
||||||
|
|
||||||
if capabilities[1] != 'E':
|
if capabilities[1] != 'E':
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if (codec == "mpeg1video"):
|
if (codec == "mpeg1video"):
|
||||||
mpeg1 = True
|
mpeg1 = True
|
||||||
continue
|
continue
|
||||||
if (codec == "mpeg2video"):
|
if (codec == "mpeg2video"):
|
||||||
mpeg2 = True
|
mpeg2 = True
|
||||||
continue
|
continue
|
||||||
if (codec == "mp2"):
|
if (codec == "mp2"):
|
||||||
mp2 = True
|
mp2 = True
|
||||||
continue
|
continue
|
||||||
if (codec == "mp3"):
|
if (codec == "mp3"):
|
||||||
mp3 = True
|
mp3 = True
|
||||||
continue
|
continue
|
||||||
if (codec == "ac3"):
|
if (codec == "ac3"):
|
||||||
ac3 = True
|
ac3 = True
|
||||||
continue
|
continue
|
||||||
if (codec == "h264") or (codec == "H264"):
|
if (codec == "h264") or (codec == "H264"):
|
||||||
h264 = True
|
h264 = True
|
||||||
continue
|
continue
|
||||||
if (codec == "mpeg4"):
|
if (codec == "mpeg4"):
|
||||||
divx = True
|
divx = True
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if (mpeg1 and mp2):
|
if (mpeg1 and mp2):
|
||||||
devedeng.avconv.avconv.disc_types.append("vcd")
|
devedeng.avconv.avconv.disc_types.append("vcd")
|
||||||
if (mpeg2 and mp2):
|
if (mpeg2 and mp2):
|
||||||
devedeng.avconv.avconv.disc_types.append("svcd")
|
devedeng.avconv.avconv.disc_types.append("svcd")
|
||||||
devedeng.avconv.avconv.disc_types.append("cvd")
|
devedeng.avconv.avconv.disc_types.append("cvd")
|
||||||
if (mpeg2 and mp2 and ac3):
|
if (mpeg2 and mp2 and ac3):
|
||||||
devedeng.avconv.avconv.disc_types.append("dvd")
|
devedeng.avconv.avconv.disc_types.append("dvd")
|
||||||
if (divx and mp3):
|
if (divx and mp3):
|
||||||
devedeng.avconv.avconv.disc_types.append("divx")
|
devedeng.avconv.avconv.disc_types.append("divx")
|
||||||
if (h264 and mp3):
|
if (h264 and mp3):
|
||||||
devedeng.avconv.avconv.disc_types.append("mkv")
|
devedeng.avconv.avconv.disc_types.append("mkv")
|
||||||
|
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
except:
|
except:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
|
||||||
devedeng.executor.executor.__init__(self)
|
devedeng.executor.executor.__init__(self)
|
||||||
self.config = devedeng.configuration_data.configuration.get_config()
|
self.config = devedeng.configuration_data.configuration.get_config()
|
||||||
self.check_version(["avconv","-version"])
|
self.check_version(["avconv","-version"])
|
||||||
|
|
||||||
|
|
||||||
def convert_file(self,file_project,output_file,video_length,pass2 = False):
|
def convert_file(self,file_project,output_file,video_length,pass2 = False):
|
||||||
|
|
||||||
if file_project.two_pass_encoding:
|
if file_project.two_pass_encoding:
|
||||||
if pass2:
|
if pass2:
|
||||||
self.text = _("Converting %(X)s (pass 2)") % {"X" : file_project.title_name}
|
self.text = _("Converting %(X)s (pass 2)") % {"X" : file_project.title_name}
|
||||||
else:
|
else:
|
||||||
self.text = _("Converting %(X)s (pass 1)") % {"X" : file_project.title_name}
|
self.text = _("Converting %(X)s (pass 1)") % {"X" : file_project.title_name}
|
||||||
# Prepare the converting process for the second pass
|
# Prepare the converting process for the second pass
|
||||||
tmp = devedeng.avconv.avconv()
|
tmp = devedeng.avconv.avconv()
|
||||||
tmp.convert_file(file_project, output_file, video_length, True)
|
tmp.convert_file(file_project, output_file, video_length, True)
|
||||||
# it deppends of this process
|
# it deppends of this process
|
||||||
tmp.add_dependency(self)
|
tmp.add_dependency(self)
|
||||||
# add it as a child process of this one
|
# add it as a child process of this one
|
||||||
self.add_child_process(tmp)
|
self.add_child_process(tmp)
|
||||||
else:
|
else:
|
||||||
self.text = _("Converting %(X)s") % {"X" : file_project.title_name}
|
self.text = _("Converting %(X)s") % {"X" : file_project.title_name}
|
||||||
|
|
||||||
if (pass2 == False) and (file_project.two_pass_encoding == True):
|
if (pass2 == False) and (file_project.two_pass_encoding == True):
|
||||||
# this is the first pass in a 2-pass codification
|
# this is the first pass in a 2-pass codification
|
||||||
second_pass = False
|
second_pass = False
|
||||||
else:
|
else:
|
||||||
# second_pass is TRUE in the second pass of a 2-pass codification, and also when not doing 2-pass codification
|
# second_pass is TRUE in the second pass of a 2-pass codification, and also when not doing 2-pass codification
|
||||||
# It is used to remove unnecessary steps during the first pass, but that are needed on the second pass, or when not using 2-pass codification
|
# It is used to remove unnecessary steps during the first pass, but that are needed on the second pass, or when not using 2-pass codification
|
||||||
second_pass = True
|
second_pass = True
|
||||||
|
|
||||||
if (video_length == 0):
|
if (video_length == 0):
|
||||||
self.final_length = file_project.original_length
|
self.final_length = file_project.original_length
|
||||||
else:
|
else:
|
||||||
self.final_length = video_length
|
self.final_length = video_length
|
||||||
self.command_var=[]
|
self.command_var=[]
|
||||||
self.command_var.append("avconv")
|
self.command_var.append("avconv")
|
||||||
self.command_var.append("-i")
|
self.command_var.append("-i")
|
||||||
self.command_var.append(file_project.file_name)
|
self.command_var.append(file_project.file_name)
|
||||||
|
|
||||||
if (file_project.volume!=100) and second_pass:
|
if (file_project.volume!=100) and second_pass:
|
||||||
self.command_var.append("-vol")
|
self.command_var.append("-vol")
|
||||||
self.command_var.append(str(int((256*file_project.volume)/100)))
|
self.command_var.append(str(int((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) and second_pass:
|
if (file_project.audio_delay != 0.0) and (file_project.copy_sound==False) and (file_project.no_reencode_audio_video==False) and second_pass:
|
||||||
self.command_var.append("-itsoffset")
|
self.command_var.append("-itsoffset")
|
||||||
self.command_var.append(str(file_project.audio_delay))
|
self.command_var.append(str(file_project.audio_delay))
|
||||||
|
|
||||||
self.command_var.append("-i")
|
self.command_var.append("-i")
|
||||||
self.command_var.append(file_project.file_name)
|
self.command_var.append(file_project.file_name)
|
||||||
self.command_var.append("-map")
|
self.command_var.append("-map")
|
||||||
self.command_var.append("1:"+str(file_project.video_list[0]))
|
self.command_var.append("1:"+str(file_project.video_list[0]))
|
||||||
if (not file_project.copy_sound) and (not file_project.no_reencode_audio_video):
|
if (not file_project.copy_sound) and (not file_project.no_reencode_audio_video):
|
||||||
for l in file_project.audio_list:
|
for l in file_project.audio_list:
|
||||||
self.command_var.append("-map")
|
self.command_var.append("-map")
|
||||||
self.command_var.append("0:"+str(l))
|
self.command_var.append("0:"+str(l))
|
||||||
|
|
||||||
if (file_project.no_reencode_audio_video==False) and second_pass:
|
if (file_project.no_reencode_audio_video==False) and second_pass:
|
||||||
cmd_line=""
|
cmd_line=""
|
||||||
|
|
||||||
if file_project.deinterlace=="deinterlace_yadif":
|
if file_project.deinterlace=="deinterlace_yadif":
|
||||||
cmd_line+="yadif"
|
cmd_line+="yadif"
|
||||||
|
|
||||||
vflip=False
|
vflip=False
|
||||||
hflip=False
|
hflip=False
|
||||||
|
|
||||||
if (file_project.rotation=="rotation_90"):
|
if (file_project.rotation=="rotation_90"):
|
||||||
if (cmd_line!=""):
|
if (cmd_line!=""):
|
||||||
cmd_line+=",fifo,"
|
cmd_line+=",fifo,"
|
||||||
cmd_line+="transpose=1"
|
cmd_line+="transpose=1"
|
||||||
elif (file_project.rotation=="rotation_270"):
|
elif (file_project.rotation=="rotation_270"):
|
||||||
if (cmd_line!=""):
|
if (cmd_line!=""):
|
||||||
cmd_line+=",fifo,"
|
cmd_line+=",fifo,"
|
||||||
cmd_line+="transpose=2"
|
cmd_line+="transpose=2"
|
||||||
elif (file_project.rotation=="rotation_180"):
|
elif (file_project.rotation=="rotation_180"):
|
||||||
vflip=True
|
vflip=True
|
||||||
hflip=True
|
hflip=True
|
||||||
|
|
||||||
if (file_project.mirror_vertical):
|
if (file_project.mirror_vertical):
|
||||||
vflip=not vflip
|
vflip=not vflip
|
||||||
if (file_project.mirror_horizontal):
|
if (file_project.mirror_horizontal):
|
||||||
hflip=not hflip
|
hflip=not hflip
|
||||||
|
|
||||||
if (vflip):
|
if (vflip):
|
||||||
if (cmd_line!=""):
|
if (cmd_line!=""):
|
||||||
cmd_line+=",fifo,"
|
cmd_line+=",fifo,"
|
||||||
cmd_line+="vflip"
|
cmd_line+="vflip"
|
||||||
if (hflip):
|
if (hflip):
|
||||||
if (cmd_line!=""):
|
if (cmd_line!=""):
|
||||||
cmd_line+=",fifo,"
|
cmd_line+=",fifo,"
|
||||||
cmd_line+="hflip"
|
cmd_line+="hflip"
|
||||||
|
|
||||||
if (file_project.width_midle != file_project.original_width) or (file_project.height_midle != file_project.original_height):
|
if (file_project.width_midle != file_project.original_width) or (file_project.height_midle != file_project.original_height):
|
||||||
if (cmd_line!=""):
|
if (cmd_line!=""):
|
||||||
cmd_line+=",fifo,"
|
cmd_line+=",fifo,"
|
||||||
x = int((file_project.width_midle - file_project.original_width) /2)
|
x = int((file_project.width_midle - file_project.original_width) /2)
|
||||||
y = int((file_project.height_midle - file_project.original_height) /2)
|
y = int((file_project.height_midle - file_project.original_height) /2)
|
||||||
if (x > 0) or (y > 0):
|
if (x > 0) or (y > 0):
|
||||||
cmd_line+="pad="+str(file_project.width_midle)+":"+str(file_project.height_midle)+":"+str(x)+":"+str(y)+":0x000000"
|
cmd_line+="pad="+str(file_project.width_midle)+":"+str(file_project.height_midle)+":"+str(x)+":"+str(y)+":0x000000"
|
||||||
else:
|
else:
|
||||||
cmd_line+="crop="+str(file_project.width_midle)+":"+str(file_project.height_midle)+":"+str(x)+":"+str(y)
|
cmd_line+="crop="+str(file_project.width_midle)+":"+str(file_project.height_midle)+":"+str(x)+":"+str(y)
|
||||||
|
|
||||||
if (file_project.width_final != file_project.width_midle) or (file_project.height_final != file_project.height_midle):
|
if (file_project.width_final != file_project.width_midle) or (file_project.height_final != file_project.height_midle):
|
||||||
if (cmd_line!=""):
|
if (cmd_line!=""):
|
||||||
cmd_line+=",fifo,"
|
cmd_line+=",fifo,"
|
||||||
if self.major_version < 11:
|
if self.major_version < 11:
|
||||||
cmd_line+="scale="+str(file_project.width_final)+":"+str(file_project.height_final)
|
cmd_line+="scale="+str(file_project.width_final)+":"+str(file_project.height_final)
|
||||||
else:
|
else:
|
||||||
cmd_line+="scale=w="+str(file_project.width_final)+":h="+str(file_project.height_final)
|
cmd_line+="scale=w="+str(file_project.width_final)+":h="+str(file_project.height_final)
|
||||||
|
|
||||||
if cmd_line!="":
|
if cmd_line!="":
|
||||||
self.command_var.append("-vf")
|
self.command_var.append("-vf")
|
||||||
self.command_var.append(cmd_line)
|
self.command_var.append(cmd_line)
|
||||||
|
|
||||||
|
|
||||||
self.command_var.append("-y")
|
self.command_var.append("-y")
|
||||||
|
|
||||||
vcd = False
|
vcd = False
|
||||||
|
|
||||||
maxrate = int(file_project.video_rate_final * 1500)
|
maxrate = int(file_project.video_rate_final * 1500)
|
||||||
minrate = int(file_project.video_rate_final * 666.66)
|
minrate = int(file_project.video_rate_final * 666.66)
|
||||||
|
|
||||||
if (self.config.disc_type == "divx"):
|
if (self.config.disc_type == "divx"):
|
||||||
self.command_var.append("-vcodec")
|
self.command_var.append("-vcodec")
|
||||||
self.command_var.append("mpeg4")
|
self.command_var.append("mpeg4")
|
||||||
self.command_var.append("-acodec")
|
self.command_var.append("-acodec")
|
||||||
self.command_var.append("libmp3lame")
|
self.command_var.append("libmp3lame")
|
||||||
self.command_var.append("-f")
|
self.command_var.append("-f")
|
||||||
self.command_var.append("avi")
|
self.command_var.append("avi")
|
||||||
elif (self.config.disc_type == "mkv"):
|
self.command_var.append("-maxrate:v")
|
||||||
self.command_var.append("-vcodec")
|
self.command_var.append(str(maxrate))
|
||||||
self.command_var.append("h264")
|
self.command_var.append("-minrate:v")
|
||||||
self.command_var.append("-acodec")
|
if minrate < (devedeng.project.devede_project.divx_min_bps * 1000):
|
||||||
self.command_var.append("libmp3lame")
|
minrate = devedeng.project.devede_project.divx_min_bps * 1000
|
||||||
self.command_var.append("-f")
|
self.command_var.append(str(minrate))
|
||||||
self.command_var.append("matroska")
|
elif (self.config.disc_type == "mkv"):
|
||||||
else:
|
self.command_var.append("-vcodec")
|
||||||
if (self.config.disc_type=="dvd"):
|
self.command_var.append("h264")
|
||||||
if not file_project.no_reencode_audio_video:
|
self.command_var.append("-acodec")
|
||||||
self.command_var.append("-c:v")
|
self.command_var.append("libmp3lame")
|
||||||
self.command_var.append("mpeg2video")
|
self.command_var.append("-f")
|
||||||
if not file_project.copy_sound:
|
self.command_var.append("matroska")
|
||||||
if file_project.sound5_1:
|
self.command_var.append("-maxrate:v")
|
||||||
self.command_var.append("-c:a")
|
self.command_var.append(str(maxrate))
|
||||||
self.command_var.append("ac3")
|
self.command_var.append("-minrate:v")
|
||||||
else:
|
if minrate < (devedeng.project.devede_project.mkv_min_bps * 1000):
|
||||||
self.command_var.append("-c:a")
|
minrate = devedeng.project.devede_project.mkv_min_bps * 1000
|
||||||
if file_project.format_pal:
|
self.command_var.append(str(minrate))
|
||||||
self.command_var.append("ac3")
|
elif (self.config.disc_type=="dvd"):
|
||||||
else:
|
if not file_project.no_reencode_audio_video:
|
||||||
self.command_var.append("mp2")
|
self.command_var.append("-c:v")
|
||||||
self.command_var.append("-f")
|
self.command_var.append("mpeg2video")
|
||||||
self.command_var.append("dvd")
|
if not file_project.copy_sound:
|
||||||
self.command_var.append("-r")
|
if file_project.sound5_1:
|
||||||
if file_project.format_pal:
|
self.command_var.append("-c:a")
|
||||||
self.command_var.append("25")
|
self.command_var.append("ac3")
|
||||||
else:
|
else:
|
||||||
if (file_project.original_fps == 24):
|
self.command_var.append("-c:a")
|
||||||
self.command_var.append("24000/1001")
|
if file_project.format_pal:
|
||||||
else:
|
self.command_var.append("ac3")
|
||||||
self.command_var.append("30000/1001")
|
else:
|
||||||
self.command_var.append("-pix_fmt")
|
self.command_var.append("mp2")
|
||||||
self.command_var.append("yuv420p")
|
self.command_var.append("-f")
|
||||||
self.command_var.append("-maxrate:v")
|
self.command_var.append("dvd")
|
||||||
if maxrate > 9000000:
|
self.command_var.append("-r")
|
||||||
maxrate = 9000000
|
if file_project.format_pal:
|
||||||
self.command_var.append(str(maxrate))
|
self.command_var.append("25")
|
||||||
self.command_var.append("-minrate:v")
|
else:
|
||||||
if minrate < 15000000:
|
if (file_project.original_fps == 24):
|
||||||
minrate = 15000000
|
self.command_var.append("24000/1001")
|
||||||
self.command_var.append(str(minrate))
|
else:
|
||||||
self.command_var.append("-bufsize")
|
self.command_var.append("30000/1001")
|
||||||
self.command_var.append("1835008")
|
self.command_var.append("-pix_fmt")
|
||||||
self.command_var.append("-packetsize")
|
self.command_var.append("yuv420p")
|
||||||
self.command_var.append("2048")
|
self.command_var.append("-maxrate:v")
|
||||||
self.command_var.append("-muxrate")
|
if maxrate > (devedeng.project.devede_project.dvd_max_bps_base[0] * 1000):
|
||||||
self.command_var.append("10080000")
|
maxrate = devedeng.project.devede_project.dvd_max_bps_base[0] * 1000
|
||||||
self.command_var.append("-ar")
|
self.command_var.append(str(maxrate))
|
||||||
self.command_var.append("48000")
|
self.command_var.append("-minrate:v")
|
||||||
elif (self.config.disc_type=="vcd"):
|
if minrate < (devedeng.project.devede_project.dvd_min_bps * 1000):
|
||||||
vcd = True
|
minrate = devedeng.project.devede_project.dvd_min_bps * 1000
|
||||||
if not file_project.no_reencode_audio_video:
|
self.command_var.append(str(minrate))
|
||||||
self.command_var.append("-c:v")
|
self.command_var.append("-bufsize")
|
||||||
self.command_var.append("mpeg1video")
|
self.command_var.append("1835008")
|
||||||
if not file_project.copy_sound:
|
self.command_var.append("-packetsize")
|
||||||
self.command_var.append("-c:a")
|
self.command_var.append("2048")
|
||||||
self.command_var.append("mp2")
|
self.command_var.append("-muxrate")
|
||||||
self.command_var.append("-b:v")
|
self.command_var.append("10080000")
|
||||||
self.command_var.append("1150000")
|
self.command_var.append("-ar")
|
||||||
self.command_var.append("-b:a")
|
self.command_var.append("48000")
|
||||||
self.command_var.append("224000")
|
elif (self.config.disc_type=="vcd"):
|
||||||
self.command_var.append("-f")
|
vcd = True
|
||||||
self.command_var.append("vcd")
|
if not file_project.no_reencode_audio_video:
|
||||||
self.command_var.append("-r")
|
self.command_var.append("-c:v")
|
||||||
if file_project.format_pal:
|
self.command_var.append("mpeg1video")
|
||||||
self.command_var.append("25")
|
if not file_project.copy_sound:
|
||||||
else:
|
self.command_var.append("-c:a")
|
||||||
if (file_project.original_fps == 24):
|
self.command_var.append("mp2")
|
||||||
self.command_var.append("24000/1001")
|
self.command_var.append("-b:v")
|
||||||
else:
|
self.command_var.append("1150000")
|
||||||
self.command_var.append("30000/1001")
|
self.command_var.append("-b:a")
|
||||||
self.command_var.append("-g")
|
self.command_var.append("224000")
|
||||||
if file_project.format_pal:
|
self.command_var.append("-f")
|
||||||
self.command_var.append("15")
|
self.command_var.append("vcd")
|
||||||
else:
|
self.command_var.append("-r")
|
||||||
self.command_var.append("18")
|
if file_project.format_pal:
|
||||||
self.command_var.append("-s")
|
self.command_var.append("25")
|
||||||
if file_project.format_pal:
|
else:
|
||||||
self.command_var.append("352x288")
|
if (file_project.original_fps == 24):
|
||||||
else:
|
self.command_var.append("24000/1001")
|
||||||
self.command_var.append("352x240")
|
else:
|
||||||
self.command_var.append("-maxrate:v")
|
self.command_var.append("30000/1001")
|
||||||
self.command_var.append("1150000")
|
self.command_var.append("-g")
|
||||||
self.command_var.append("-minrate:v")
|
if file_project.format_pal:
|
||||||
self.command_var.append("1150000")
|
self.command_var.append("15")
|
||||||
self.command_var.append("-bufsize")
|
else:
|
||||||
self.command_var.append("327680")
|
self.command_var.append("18")
|
||||||
self.command_var.append("-packetsize")
|
self.command_var.append("-s")
|
||||||
self.command_var.append("2324")
|
if file_project.format_pal:
|
||||||
self.command_var.append("-muxrate")
|
self.command_var.append("352x288")
|
||||||
self.command_var.append("1411200")
|
else:
|
||||||
self.command_var.append("-ar")
|
self.command_var.append("352x240")
|
||||||
self.command_var.append("44100")
|
self.command_var.append("-maxrate:v")
|
||||||
elif (self.config.disc_type=="svcd") or (self.config.disc_type=="cvd"):
|
self.command_var.append("1150000")
|
||||||
if not file_project.no_reencode_audio_video:
|
self.command_var.append("-minrate:v")
|
||||||
self.command_var.append("-c:v")
|
self.command_var.append("1150000")
|
||||||
self.command_var.append("mpeg2video")
|
self.command_var.append("-bufsize")
|
||||||
if not file_project.copy_sound:
|
self.command_var.append("327680")
|
||||||
self.command_var.append("-c:a")
|
self.command_var.append("-packetsize")
|
||||||
self.command_var.append("mp2")
|
self.command_var.append("2324")
|
||||||
self.command_var.append("-f")
|
self.command_var.append("-muxrate")
|
||||||
self.command_var.append("svcd")
|
self.command_var.append("1411200")
|
||||||
self.command_var.append("-r")
|
self.command_var.append("-ar")
|
||||||
if file_project.format_pal:
|
self.command_var.append("44100")
|
||||||
self.command_var.append("25")
|
elif (self.config.disc_type=="svcd") or (self.config.disc_type=="cvd"):
|
||||||
else:
|
if not file_project.no_reencode_audio_video:
|
||||||
if (file_project.original_fps == 24):
|
self.command_var.append("-c:v")
|
||||||
self.command_var.append("24000/1001")
|
self.command_var.append("mpeg2video")
|
||||||
else:
|
if not file_project.copy_sound:
|
||||||
self.command_var.append("30000/1001")
|
self.command_var.append("-c:a")
|
||||||
self.command_var.append("-g")
|
self.command_var.append("mp2")
|
||||||
if file_project.format_pal:
|
self.command_var.append("-f")
|
||||||
self.command_var.append("12")
|
self.command_var.append("svcd")
|
||||||
else:
|
self.command_var.append("-r")
|
||||||
self.command_var.append("15")
|
if file_project.format_pal:
|
||||||
self.command_var.append("-s")
|
self.command_var.append("25")
|
||||||
if self.config.disc_type == "cvd":
|
else:
|
||||||
if file_project.format_pal:
|
if (file_project.original_fps == 24):
|
||||||
self.command_var.append("352x576")
|
self.command_var.append("24000/1001")
|
||||||
else:
|
else:
|
||||||
self.command_var.append("352x480")
|
self.command_var.append("30000/1001")
|
||||||
else:
|
self.command_var.append("-g")
|
||||||
if file_project.format_pal:
|
if file_project.format_pal:
|
||||||
self.command_var.append("480x576")
|
self.command_var.append("12")
|
||||||
else:
|
else:
|
||||||
self.command_var.append("480x480")
|
self.command_var.append("15")
|
||||||
self.command_var.append("-pix_fmt")
|
self.command_var.append("-s")
|
||||||
self.command_var.append("yuv420p")
|
if self.config.disc_type == "cvd":
|
||||||
self.command_var.append("-maxrate:v")
|
if file_project.format_pal:
|
||||||
if maxrate > 2516000:
|
self.command_var.append("352x576")
|
||||||
maxrate = 2516000
|
else:
|
||||||
self.command_var.append(str(maxrate))
|
self.command_var.append("352x480")
|
||||||
self.command_var.append("-minrate:v")
|
else:
|
||||||
if minrate < 1145000:
|
if file_project.format_pal:
|
||||||
minrate = 1145000
|
self.command_var.append("480x576")
|
||||||
self.command_var.append(str(minrate))
|
else:
|
||||||
self.command_var.append("-bufsize")
|
self.command_var.append("480x480")
|
||||||
self.command_var.append("1835008")
|
self.command_var.append("-pix_fmt")
|
||||||
self.command_var.append("-packetsize")
|
self.command_var.append("yuv420p")
|
||||||
self.command_var.append("2324")
|
self.command_var.append("-maxrate:v")
|
||||||
self.command_var.append("-ar")
|
if maxrate > (devedeng.project.devede_project.svcd_max_bps_base[0] * 1000):
|
||||||
self.command_var.append("44100")
|
maxrate = devedeng.project.devede_project.svcd_max_bps_base[0] * 1000
|
||||||
self.command_var.append("-scan_offset")
|
self.command_var.append(str(maxrate))
|
||||||
self.command_var.append("1")
|
self.command_var.append("-minrate:v")
|
||||||
|
if minrate < (devedeng.project.devede_project.svcd_min_bps * 1000):
|
||||||
|
minrate = (devedeng.project.devede_project.svcd_min_bps * 1000)
|
||||||
|
self.command_var.append(str(minrate))
|
||||||
|
self.command_var.append("-bufsize")
|
||||||
|
self.command_var.append("1835008")
|
||||||
|
self.command_var.append("-packetsize")
|
||||||
|
self.command_var.append("2324")
|
||||||
|
self.command_var.append("-ar")
|
||||||
|
self.command_var.append("44100")
|
||||||
|
self.command_var.append("-scan_offset")
|
||||||
|
self.command_var.append("1")
|
||||||
|
|
||||||
if (not file_project.no_reencode_audio_video):
|
if (not file_project.no_reencode_audio_video):
|
||||||
self.command_var.append("-sn") # no subtitles
|
self.command_var.append("-sn") # no subtitles
|
||||||
|
|
||||||
if file_project.copy_sound or file_project.no_reencode_audio_video:
|
if file_project.copy_sound or file_project.no_reencode_audio_video:
|
||||||
self.command_var.append("-acodec")
|
self.command_var.append("-acodec")
|
||||||
self.command_var.append("copy")
|
self.command_var.append("copy")
|
||||||
|
|
||||||
if file_project.no_reencode_audio_video:
|
if file_project.no_reencode_audio_video:
|
||||||
self.command_var.append("-vcodec")
|
self.command_var.append("-vcodec")
|
||||||
self.command_var.append("copy")
|
self.command_var.append("copy")
|
||||||
|
|
||||||
if (not vcd):
|
if (not vcd):
|
||||||
if not file_project.format_pal:
|
if not file_project.format_pal:
|
||||||
if (file_project.original_fps==24) and ((self.config.disc_type=="dvd")):
|
if (file_project.original_fps==24) and ((self.config.disc_type=="dvd")):
|
||||||
keyintv=15
|
keyintv=15
|
||||||
else:
|
else:
|
||||||
keyintv=18
|
keyintv=18
|
||||||
else:
|
else:
|
||||||
keyintv=15
|
keyintv=15
|
||||||
|
|
||||||
if (not file_project.gop12) and (not(self.config.disc_type == "divx")) and (not(self.config.disc_type == "mkv")):
|
if (not file_project.gop12) and (not(self.config.disc_type == "divx")) and (not(self.config.disc_type == "mkv")):
|
||||||
self.command_var.append("-g")
|
self.command_var.append("-g")
|
||||||
self.command_var.append(str(keyintv))
|
self.command_var.append(str(keyintv))
|
||||||
|
|
||||||
if (self.config.disc_type == "divx") or (self.config.disc_type == "mkv"):
|
if (self.config.disc_type == "divx") or (self.config.disc_type == "mkv"):
|
||||||
self.command_var.append("-g")
|
self.command_var.append("-g")
|
||||||
self.command_var.append("300")
|
self.command_var.append("300")
|
||||||
elif file_project.gop12 and (file_project.no_reencode_audio_video == False):
|
elif file_project.gop12 and (file_project.no_reencode_audio_video == False):
|
||||||
self.command_var.append("-g")
|
self.command_var.append("-g")
|
||||||
self.command_var.append("12")
|
self.command_var.append("12")
|
||||||
|
|
||||||
self.command_var.append("-bf")
|
self.command_var.append("-bf")
|
||||||
self.command_var.append("2")
|
self.command_var.append("2")
|
||||||
self.command_var.append("-strict")
|
self.command_var.append("-strict")
|
||||||
self.command_var.append("1")
|
self.command_var.append("1")
|
||||||
|
|
||||||
if video_length != 0:
|
if video_length != 0:
|
||||||
self.command_var.append("-t")
|
self.command_var.append("-t")
|
||||||
self.command_var.append(str(video_length))
|
self.command_var.append(str(video_length))
|
||||||
|
|
||||||
self.command_var.append("-ac")
|
self.command_var.append("-ac")
|
||||||
if (file_project.sound5_1) and ((self.config.disc_type=="dvd") or (self.config.disc_type=="divx") or (self.config.disc_type=="mkv")):
|
if (file_project.sound5_1) and ((self.config.disc_type=="dvd") or (self.config.disc_type=="divx") or (self.config.disc_type=="mkv")):
|
||||||
self.command_var.append("6")
|
self.command_var.append("6")
|
||||||
else:
|
else:
|
||||||
self.command_var.append("2")
|
self.command_var.append("2")
|
||||||
|
|
||||||
self.command_var.append("-aspect")
|
self.command_var.append("-aspect")
|
||||||
self.command_var.append(str(file_project.aspect_ratio_final))
|
self.command_var.append(str(file_project.aspect_ratio_final))
|
||||||
|
|
||||||
if self.config.disc_type=="divx":
|
if self.config.disc_type=="divx":
|
||||||
self.command_var.append("-vtag")
|
self.command_var.append("-vtag")
|
||||||
self.command_var.append("DX50")
|
self.command_var.append("DX50")
|
||||||
|
|
||||||
if (file_project.deinterlace == "deinterlace_ffmpeg") and (file_project.no_reencode_audio_video==False) and second_pass:
|
if (file_project.deinterlace == "deinterlace_ffmpeg") and (file_project.no_reencode_audio_video==False) and second_pass:
|
||||||
self.command_var.append("-deinterlace")
|
self.command_var.append("-deinterlace")
|
||||||
|
|
||||||
if (file_project.no_reencode_audio_video==False) and (vcd==False) and second_pass:
|
if (file_project.no_reencode_audio_video==False) and (vcd==False) and second_pass:
|
||||||
self.command_var.append("-s")
|
self.command_var.append("-s")
|
||||||
self.command_var.append(str(file_project.width_final)+"x"+str(file_project.height_final))
|
self.command_var.append(str(file_project.width_final)+"x"+str(file_project.height_final))
|
||||||
|
|
||||||
if second_pass:
|
if second_pass:
|
||||||
self.command_var.append("-trellis")
|
self.command_var.append("-trellis")
|
||||||
self.command_var.append("1")
|
self.command_var.append("1")
|
||||||
self.command_var.append("-mbd")
|
self.command_var.append("-mbd")
|
||||||
self.command_var.append("2")
|
self.command_var.append("2")
|
||||||
else:
|
else:
|
||||||
self.command_var.append("-trellis")
|
self.command_var.append("-trellis")
|
||||||
self.command_var.append("0")
|
self.command_var.append("0")
|
||||||
self.command_var.append("-mbd")
|
self.command_var.append("-mbd")
|
||||||
self.command_var.append("0")
|
self.command_var.append("0")
|
||||||
|
|
||||||
if (vcd == False) and (file_project.no_reencode_audio_video == False):
|
if (vcd == False) and (file_project.no_reencode_audio_video == False):
|
||||||
self.command_var.append("-b:a")
|
self.command_var.append("-b:a")
|
||||||
self.command_var.append(str(file_project.audio_rate_final)+"k")
|
self.command_var.append(str(file_project.audio_rate_final)+"k")
|
||||||
|
|
||||||
self.command_var.append("-b:v")
|
self.command_var.append("-b:v")
|
||||||
self.command_var.append(str(file_project.video_rate_final)+"k")
|
self.command_var.append(str(file_project.video_rate_final)+"k")
|
||||||
|
|
||||||
if file_project.two_pass_encoding == True:
|
if file_project.two_pass_encoding == True:
|
||||||
self.command_var.append("-passlogfile")
|
self.command_var.append("-passlogfile")
|
||||||
self.command_var.append(output_file)
|
self.command_var.append(output_file)
|
||||||
self.command_var.append("-pass")
|
self.command_var.append("-pass")
|
||||||
if pass2:
|
if pass2:
|
||||||
self.command_var.append("2")
|
self.command_var.append("2")
|
||||||
else:
|
else:
|
||||||
self.command_var.append("1")
|
self.command_var.append("1")
|
||||||
|
|
||||||
self.command_var.append(output_file)
|
self.command_var.append(output_file)
|
||||||
|
|
||||||
|
|
||||||
def create_menu_mpeg(self,n_page,background_music,sound_length,pal,video_rate, audio_rate,output_path, use_mp2):
|
def create_menu_mpeg(self,n_page,background_music,sound_length,pal,video_rate, audio_rate,output_path, use_mp2):
|
||||||
|
|
||||||
self.n_page = n_page
|
self.n_page = n_page
|
||||||
self.final_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=[]
|
||||||
self.command_var.append("avconv")
|
self.command_var.append("avconv")
|
||||||
|
|
||||||
self.command_var.append("-loop")
|
self.command_var.append("-loop")
|
||||||
self.command_var.append("1")
|
self.command_var.append("1")
|
||||||
|
|
||||||
self.command_var.append("-f")
|
self.command_var.append("-f")
|
||||||
self.command_var.append("image2")
|
self.command_var.append("image2")
|
||||||
self.command_var.append("-i")
|
self.command_var.append("-i")
|
||||||
self.command_var.append(os.path.join(output_path,"menu_"+str(n_page)+"_bg.png"))
|
self.command_var.append(os.path.join(output_path,"menu_"+str(n_page)+"_bg.png"))
|
||||||
self.command_var.append("-i")
|
self.command_var.append("-i")
|
||||||
self.command_var.append(background_music)
|
self.command_var.append(background_music)
|
||||||
|
|
||||||
self.command_var.append("-y")
|
self.command_var.append("-y")
|
||||||
self.command_var.append("-target")
|
self.command_var.append("-target")
|
||||||
if pal:
|
if pal:
|
||||||
self.command_var.append("pal-dvd")
|
self.command_var.append("pal-dvd")
|
||||||
else:
|
else:
|
||||||
self.command_var.append("ntsc-dvd")
|
self.command_var.append("ntsc-dvd")
|
||||||
self.command_var.append("-acodec")
|
self.command_var.append("-acodec")
|
||||||
if (use_mp2):
|
if (use_mp2):
|
||||||
self.command_var.append("mp2")
|
self.command_var.append("mp2")
|
||||||
if (audio_rate > 384):
|
if (audio_rate > 384):
|
||||||
audio_rate = 384 #max bitrate for mp2
|
audio_rate = 384 #max bitrate for mp2
|
||||||
else:
|
else:
|
||||||
self.command_var.append("ac3")
|
self.command_var.append("ac3")
|
||||||
self.command_var.append("-s")
|
self.command_var.append("-s")
|
||||||
if pal:
|
if pal:
|
||||||
self.command_var.append("720x576")
|
self.command_var.append("720x576")
|
||||||
else:
|
else:
|
||||||
self.command_var.append("720x480")
|
self.command_var.append("720x480")
|
||||||
self.command_var.append("-g")
|
self.command_var.append("-g")
|
||||||
self.command_var.append("12")
|
self.command_var.append("12")
|
||||||
self.command_var.append("-b:v")
|
self.command_var.append("-b:v")
|
||||||
self.command_var.append(str(video_rate)+"k")
|
self.command_var.append(str(video_rate)+"k")
|
||||||
self.command_var.append("-b:a")
|
self.command_var.append("-b:a")
|
||||||
self.command_var.append(str(audio_rate)+"k")
|
self.command_var.append(str(audio_rate)+"k")
|
||||||
self.command_var.append("-aspect")
|
self.command_var.append("-aspect")
|
||||||
self.command_var.append("4:3")
|
self.command_var.append("4:3")
|
||||||
|
|
||||||
self.command_var.append("-t")
|
self.command_var.append("-t")
|
||||||
self.command_var.append(str(1+sound_length))
|
self.command_var.append(str(1+sound_length))
|
||||||
|
|
||||||
movie_path = os.path.join(output_path,"menu_"+str(n_page)+".mpg")
|
movie_path = os.path.join(output_path,"menu_"+str(n_page)+".mpg")
|
||||||
self.command_var.append(movie_path)
|
self.command_var.append(movie_path)
|
||||||
|
|
||||||
muxer = devedeng.mux_dvd_menu.mux_dvd_menu()
|
muxer = devedeng.mux_dvd_menu.mux_dvd_menu()
|
||||||
final_path = muxer.create_mpg(n_page,output_path,movie_path)
|
final_path = muxer.create_mpg(n_page,output_path,movie_path)
|
||||||
# the muxer process depends of the converter process
|
# the muxer process depends of the converter process
|
||||||
muxer.add_dependency(self)
|
muxer.add_dependency(self)
|
||||||
self.add_child_process(muxer)
|
self.add_child_process(muxer)
|
||||||
|
|
||||||
return (final_path)
|
return (final_path)
|
||||||
|
|
||||||
def process_stdout(self,data):
|
def process_stdout(self,data):
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
def process_stderr(self,data):
|
def process_stderr(self,data):
|
||||||
|
|
||||||
pos = data[0].find("time=")
|
pos = data[0].find("time=")
|
||||||
if (pos != -1):
|
if (pos != -1):
|
||||||
pos+=5
|
pos+=5
|
||||||
pos2 = data[0].find(" ",pos)
|
pos2 = data[0].find(" ",pos)
|
||||||
if (pos2 != -1):
|
if (pos2 != -1):
|
||||||
parts = data[0][pos:pos2].split(":")
|
parts = data[0][pos:pos2].split(":")
|
||||||
t = 0.0
|
t = 0.0
|
||||||
for e in parts:
|
for e in parts:
|
||||||
t *= 60.0
|
t *= 60.0
|
||||||
t += float(e)
|
t += float(e)
|
||||||
t /= self.final_length
|
t /= self.final_length
|
||||||
self.progress_bar[1].set_fraction(t)
|
self.progress_bar[1].set_fraction(t)
|
||||||
self.progress_bar[1].set_text("%.1f%%" % (100.0 * t))
|
self.progress_bar[1].set_text("%.1f%%" % (100.0 * t))
|
||||||
|
|
|
||||||
|
|
@ -22,518 +22,530 @@ import os
|
||||||
import devedeng.configuration_data
|
import devedeng.configuration_data
|
||||||
import devedeng.executor
|
import devedeng.executor
|
||||||
import devedeng.mux_dvd_menu
|
import devedeng.mux_dvd_menu
|
||||||
|
import devedeng.project
|
||||||
|
|
||||||
class ffmpeg(devedeng.executor.executor):
|
class ffmpeg(devedeng.executor.executor):
|
||||||
|
|
||||||
supports_analize = False
|
supports_analize = False
|
||||||
supports_play = False
|
supports_play = False
|
||||||
supports_convert = True
|
supports_convert = True
|
||||||
supports_menu = True
|
supports_menu = True
|
||||||
supports_mkiso = False
|
supports_mkiso = False
|
||||||
supports_burn = False
|
supports_burn = False
|
||||||
display_name = "FFMPEG"
|
display_name = "FFMPEG"
|
||||||
disc_types = []
|
disc_types = []
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def check_is_installed():
|
def check_is_installed():
|
||||||
try:
|
try:
|
||||||
handle = subprocess.Popen(["ffmpeg","-codecs"], stdout = subprocess.PIPE, stderr = subprocess.PIPE)
|
handle = subprocess.Popen(["ffmpeg","-codecs"], stdout = subprocess.PIPE, stderr = subprocess.PIPE)
|
||||||
(stdout, stderr) = handle.communicate()
|
(stdout, stderr) = handle.communicate()
|
||||||
if 0==handle.wait():
|
if 0==handle.wait():
|
||||||
mp2 = False
|
mp2 = False
|
||||||
mp3 = False
|
mp3 = False
|
||||||
ac3 = False
|
ac3 = False
|
||||||
mpeg1 = False
|
mpeg1 = False
|
||||||
mpeg2 = False
|
mpeg2 = False
|
||||||
divx = False
|
divx = False
|
||||||
h264 = False
|
h264 = False
|
||||||
for line in stdout.decode("latin-1").split("\n"):
|
for line in stdout.decode("latin-1").split("\n"):
|
||||||
parts = line.strip().split(" ")
|
parts = line.strip().split(" ")
|
||||||
if len(parts) < 2:
|
if len(parts) < 2:
|
||||||
continue
|
continue
|
||||||
if len(parts[0]) != 6:
|
if len(parts[0]) != 6:
|
||||||
continue
|
continue
|
||||||
capabilities = parts[0]
|
capabilities = parts[0]
|
||||||
codec = parts[1]
|
codec = parts[1]
|
||||||
|
|
||||||
if capabilities[1] != 'E':
|
if capabilities[1] != 'E':
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if (codec == "mpeg1video"):
|
if (codec == "mpeg1video"):
|
||||||
mpeg1 = True
|
mpeg1 = True
|
||||||
continue
|
continue
|
||||||
if (codec == "mpeg2video"):
|
if (codec == "mpeg2video"):
|
||||||
mpeg2 = True
|
mpeg2 = True
|
||||||
continue
|
continue
|
||||||
if (codec == "mp2"):
|
if (codec == "mp2"):
|
||||||
mp2 = True
|
mp2 = True
|
||||||
continue
|
continue
|
||||||
if (codec == "mp3"):
|
if (codec == "mp3"):
|
||||||
mp3 = True
|
mp3 = True
|
||||||
continue
|
continue
|
||||||
if (codec == "ac3"):
|
if (codec == "ac3"):
|
||||||
ac3 = True
|
ac3 = True
|
||||||
continue
|
continue
|
||||||
if (codec == "h264") or (codec == "H264"):
|
if (codec == "h264") or (codec == "H264"):
|
||||||
h264 = True
|
h264 = True
|
||||||
continue
|
continue
|
||||||
if (codec == "mpeg4"):
|
if (codec == "mpeg4"):
|
||||||
divx = True
|
divx = True
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if (mpeg1 and mp2):
|
if (mpeg1 and mp2):
|
||||||
devedeng.ffmpeg.ffmpeg.disc_types.append("vcd")
|
devedeng.ffmpeg.ffmpeg.disc_types.append("vcd")
|
||||||
if (mpeg2 and mp2):
|
if (mpeg2 and mp2):
|
||||||
devedeng.ffmpeg.ffmpeg.disc_types.append("svcd")
|
devedeng.ffmpeg.ffmpeg.disc_types.append("svcd")
|
||||||
devedeng.ffmpeg.ffmpeg.disc_types.append("cvd")
|
devedeng.ffmpeg.ffmpeg.disc_types.append("cvd")
|
||||||
if (mpeg2 and mp2 and ac3):
|
if (mpeg2 and mp2 and ac3):
|
||||||
devedeng.ffmpeg.ffmpeg.disc_types.append("dvd")
|
devedeng.ffmpeg.ffmpeg.disc_types.append("dvd")
|
||||||
if (divx and mp3):
|
if (divx and mp3):
|
||||||
devedeng.ffmpeg.ffmpeg.disc_types.append("divx")
|
devedeng.ffmpeg.ffmpeg.disc_types.append("divx")
|
||||||
if (h264 and mp3):
|
if (h264 and mp3):
|
||||||
devedeng.ffmpeg.ffmpeg.disc_types.append("mkv")
|
devedeng.ffmpeg.ffmpeg.disc_types.append("mkv")
|
||||||
|
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
except:
|
except:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
|
||||||
devedeng.executor.executor.__init__(self)
|
devedeng.executor.executor.__init__(self)
|
||||||
self.config = devedeng.configuration_data.configuration.get_config()
|
self.config = devedeng.configuration_data.configuration.get_config()
|
||||||
|
|
||||||
def convert_file(self,file_project,output_file,video_length,pass2 = False):
|
def convert_file(self,file_project,output_file,video_length,pass2 = False):
|
||||||
|
|
||||||
if file_project.two_pass_encoding:
|
if file_project.two_pass_encoding:
|
||||||
if pass2:
|
if pass2:
|
||||||
self.text = _("Converting %(X)s (pass 2)") % {"X" : file_project.title_name}
|
self.text = _("Converting %(X)s (pass 2)") % {"X" : file_project.title_name}
|
||||||
else:
|
else:
|
||||||
self.text = _("Converting %(X)s (pass 1)") % {"X" : file_project.title_name}
|
self.text = _("Converting %(X)s (pass 1)") % {"X" : file_project.title_name}
|
||||||
# Prepare the converting process for the second pass
|
# Prepare the converting process for the second pass
|
||||||
tmp = devedeng.ffmpeg.ffmpeg()
|
tmp = devedeng.ffmpeg.ffmpeg()
|
||||||
tmp.convert_file(file_project, output_file, video_length, True)
|
tmp.convert_file(file_project, output_file, video_length, True)
|
||||||
# it deppends of this process
|
# it deppends of this process
|
||||||
tmp.add_dependency(self)
|
tmp.add_dependency(self)
|
||||||
# add it as a child process of this one
|
# add it as a child process of this one
|
||||||
self.add_child_process(tmp)
|
self.add_child_process(tmp)
|
||||||
else:
|
else:
|
||||||
self.text = _("Converting %(X)s") % {"X" : file_project.title_name}
|
self.text = _("Converting %(X)s") % {"X" : file_project.title_name}
|
||||||
|
|
||||||
if (pass2 == False) and (file_project.two_pass_encoding == True):
|
if (pass2 == False) and (file_project.two_pass_encoding == True):
|
||||||
# this is the first pass in a 2-pass codification
|
# this is the first pass in a 2-pass codification
|
||||||
second_pass = False
|
second_pass = False
|
||||||
else:
|
else:
|
||||||
# second_pass is TRUE in the second pass of a 2-pass codification, and also when not doing 2-pass codification
|
# second_pass is TRUE in the second pass of a 2-pass codification, and also when not doing 2-pass codification
|
||||||
# It is used to remove unnecessary steps during the first pass, but that are needed on the second pass, or when not using 2-pass codification
|
# It is used to remove unnecessary steps during the first pass, but that are needed on the second pass, or when not using 2-pass codification
|
||||||
second_pass = True
|
second_pass = True
|
||||||
|
|
||||||
if (video_length == 0):
|
if (video_length == 0):
|
||||||
self.final_length = file_project.original_length
|
self.final_length = file_project.original_length
|
||||||
else:
|
else:
|
||||||
self.final_length = video_length
|
self.final_length = video_length
|
||||||
self.command_var=[]
|
self.command_var=[]
|
||||||
self.command_var.append("ffmpeg")
|
self.command_var.append("ffmpeg")
|
||||||
self.command_var.append("-i")
|
self.command_var.append("-i")
|
||||||
self.command_var.append(file_project.file_name)
|
self.command_var.append(file_project.file_name)
|
||||||
|
|
||||||
if (file_project.volume!=100) and second_pass:
|
if (file_project.volume!=100) and second_pass:
|
||||||
self.command_var.append("-vol")
|
self.command_var.append("-vol")
|
||||||
self.command_var.append(str(int((256*file_project.volume)/100)))
|
self.command_var.append(str(int((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) and second_pass:
|
if (file_project.audio_delay != 0.0) and (file_project.copy_sound==False) and (file_project.no_reencode_audio_video==False) and second_pass:
|
||||||
self.command_var.append("-itsoffset")
|
self.command_var.append("-itsoffset")
|
||||||
self.command_var.append(str(file_project.audio_delay))
|
self.command_var.append(str(file_project.audio_delay))
|
||||||
|
|
||||||
self.command_var.append("-i")
|
self.command_var.append("-i")
|
||||||
self.command_var.append(file_project.file_name)
|
self.command_var.append(file_project.file_name)
|
||||||
self.command_var.append("-map")
|
self.command_var.append("-map")
|
||||||
self.command_var.append("1:"+str(file_project.video_list[0]))
|
self.command_var.append("1:"+str(file_project.video_list[0]))
|
||||||
if (not file_project.copy_sound) and (not file_project.no_reencode_audio_video):
|
if (not file_project.copy_sound) and (not file_project.no_reencode_audio_video):
|
||||||
for l in file_project.audio_list:
|
for l in file_project.audio_list:
|
||||||
self.command_var.append("-map")
|
self.command_var.append("-map")
|
||||||
self.command_var.append("0:"+str(l))
|
self.command_var.append("0:"+str(l))
|
||||||
|
|
||||||
if (file_project.no_reencode_audio_video==False) and second_pass:
|
if (file_project.no_reencode_audio_video==False) and second_pass:
|
||||||
cmd_line=""
|
cmd_line=""
|
||||||
|
|
||||||
if file_project.deinterlace=="deinterlace_yadif":
|
if file_project.deinterlace=="deinterlace_yadif":
|
||||||
cmd_line+="yadif"
|
cmd_line+="yadif"
|
||||||
|
|
||||||
vflip=False
|
vflip=False
|
||||||
hflip=False
|
hflip=False
|
||||||
|
|
||||||
if (file_project.rotation=="rotation_90"):
|
if (file_project.rotation=="rotation_90"):
|
||||||
if (cmd_line!=""):
|
if (cmd_line!=""):
|
||||||
cmd_line+=",fifo,"
|
cmd_line+=",fifo,"
|
||||||
cmd_line+="transpose=1"
|
cmd_line+="transpose=1"
|
||||||
elif (file_project.rotation=="rotation_270"):
|
elif (file_project.rotation=="rotation_270"):
|
||||||
if (cmd_line!=""):
|
if (cmd_line!=""):
|
||||||
cmd_line+=",fifo,"
|
cmd_line+=",fifo,"
|
||||||
cmd_line+="transpose=2"
|
cmd_line+="transpose=2"
|
||||||
elif (file_project.rotation=="rotation_180"):
|
elif (file_project.rotation=="rotation_180"):
|
||||||
vflip=True
|
vflip=True
|
||||||
hflip=True
|
hflip=True
|
||||||
|
|
||||||
if (file_project.mirror_vertical):
|
if (file_project.mirror_vertical):
|
||||||
vflip=not vflip
|
vflip=not vflip
|
||||||
if (file_project.mirror_horizontal):
|
if (file_project.mirror_horizontal):
|
||||||
hflip=not hflip
|
hflip=not hflip
|
||||||
|
|
||||||
if (vflip):
|
if (vflip):
|
||||||
if (cmd_line!=""):
|
if (cmd_line!=""):
|
||||||
cmd_line+=",fifo,"
|
cmd_line+=",fifo,"
|
||||||
cmd_line+="vflip"
|
cmd_line+="vflip"
|
||||||
if (hflip):
|
if (hflip):
|
||||||
if (cmd_line!=""):
|
if (cmd_line!=""):
|
||||||
cmd_line+=",fifo,"
|
cmd_line+=",fifo,"
|
||||||
cmd_line+="hflip"
|
cmd_line+="hflip"
|
||||||
|
|
||||||
if (file_project.width_midle != file_project.original_width) or (file_project.height_midle != file_project.original_height):
|
if (file_project.width_midle != file_project.original_width) or (file_project.height_midle != file_project.original_height):
|
||||||
if (cmd_line!=""):
|
if (cmd_line!=""):
|
||||||
cmd_line+=",fifo,"
|
cmd_line+=",fifo,"
|
||||||
x = int((file_project.width_midle - file_project.original_width) /2)
|
x = int((file_project.width_midle - file_project.original_width) /2)
|
||||||
y = int((file_project.height_midle - file_project.original_height) /2)
|
y = int((file_project.height_midle - file_project.original_height) /2)
|
||||||
if (x > 0) or (y > 0):
|
if (x > 0) or (y > 0):
|
||||||
cmd_line+="pad="+str(file_project.width_midle)+":"+str(file_project.height_midle)+":"+str(x)+":"+str(y)+":0x000000"
|
cmd_line+="pad="+str(file_project.width_midle)+":"+str(file_project.height_midle)+":"+str(x)+":"+str(y)+":0x000000"
|
||||||
else:
|
else:
|
||||||
cmd_line+="crop="+str(file_project.width_midle)+":"+str(file_project.height_midle)+":"+str(x)+":"+str(y)
|
cmd_line+="crop="+str(file_project.width_midle)+":"+str(file_project.height_midle)+":"+str(x)+":"+str(y)
|
||||||
|
|
||||||
if (file_project.width_final != file_project.width_midle) or (file_project.height_final != file_project.height_midle):
|
if (file_project.width_final != file_project.width_midle) or (file_project.height_final != file_project.height_midle):
|
||||||
if (cmd_line!=""):
|
if (cmd_line!=""):
|
||||||
cmd_line+=",fifo,"
|
cmd_line+=",fifo,"
|
||||||
cmd_line+="scale="+str(file_project.width_final)+":"+str(file_project.height_final)
|
cmd_line+="scale="+str(file_project.width_final)+":"+str(file_project.height_final)
|
||||||
|
|
||||||
if cmd_line!="":
|
if cmd_line!="":
|
||||||
self.command_var.append("-vf")
|
self.command_var.append("-vf")
|
||||||
self.command_var.append(cmd_line)
|
self.command_var.append(cmd_line)
|
||||||
|
|
||||||
|
|
||||||
self.command_var.append("-y")
|
self.command_var.append("-y")
|
||||||
|
|
||||||
vcd = False
|
vcd = False
|
||||||
|
|
||||||
maxrate = int(file_project.video_rate_final * 1500)
|
maxrate = int(file_project.video_rate_final * 1500)
|
||||||
minrate = int(file_project.video_rate_final * 666.66)
|
minrate = int(file_project.video_rate_final * 666.66)
|
||||||
|
|
||||||
if (self.config.disc_type == "divx"):
|
if (self.config.disc_type == "divx"):
|
||||||
self.command_var.append("-vcodec")
|
self.command_var.append("-vcodec")
|
||||||
self.command_var.append("mpeg4")
|
self.command_var.append("mpeg4")
|
||||||
self.command_var.append("-acodec")
|
self.command_var.append("-acodec")
|
||||||
self.command_var.append("libmp3lame")
|
self.command_var.append("libmp3lame")
|
||||||
self.command_var.append("-f")
|
self.command_var.append("-f")
|
||||||
self.command_var.append("avi")
|
self.command_var.append("avi")
|
||||||
elif (self.config.disc_type == "mkv"):
|
self.command_var.append("-maxrate:v")
|
||||||
self.command_var.append("-vcodec")
|
self.command_var.append(str(maxrate))
|
||||||
self.command_var.append("h264")
|
self.command_var.append("-minrate:v")
|
||||||
self.command_var.append("-acodec")
|
if minrate < (devedeng.project.devede_project.divx_min_bps * 1000):
|
||||||
self.command_var.append("libmp3lame")
|
minrate = devedeng.project.devede_project.divx_min_bps * 1000
|
||||||
self.command_var.append("-f")
|
self.command_var.append(str(minrate))
|
||||||
self.command_var.append("matroska")
|
elif (self.config.disc_type == "mkv"):
|
||||||
else:
|
self.command_var.append("-vcodec")
|
||||||
if (self.config.disc_type=="dvd"):
|
self.command_var.append("h264")
|
||||||
if not file_project.no_reencode_audio_video:
|
self.command_var.append("-acodec")
|
||||||
self.command_var.append("-c:v")
|
self.command_var.append("libmp3lame")
|
||||||
self.command_var.append("mpeg2video")
|
self.command_var.append("-f")
|
||||||
if not file_project.copy_sound:
|
self.command_var.append("matroska")
|
||||||
if file_project.sound5_1:
|
self.command_var.append("-maxrate:v")
|
||||||
self.command_var.append("-c:a")
|
self.command_var.append(str(maxrate))
|
||||||
self.command_var.append("ac3")
|
self.command_var.append("-minrate:v")
|
||||||
else:
|
if minrate < (devedeng.project.devede_project.mkv_min_bps * 1000):
|
||||||
self.command_var.append("-c:a")
|
minrate = devedeng.project.devede_project.mkv_min_bps * 1000
|
||||||
if file_project.format_pal:
|
self.command_var.append(str(minrate))
|
||||||
self.command_var.append("ac3")
|
elif (self.config.disc_type=="dvd"):
|
||||||
else:
|
if not file_project.no_reencode_audio_video:
|
||||||
self.command_var.append("mp2")
|
self.command_var.append("-c:v")
|
||||||
self.command_var.append("-f")
|
self.command_var.append("mpeg2video")
|
||||||
self.command_var.append("dvd")
|
if not file_project.copy_sound:
|
||||||
self.command_var.append("-r")
|
if file_project.sound5_1:
|
||||||
if file_project.format_pal:
|
self.command_var.append("-c:a")
|
||||||
self.command_var.append("25")
|
self.command_var.append("ac3")
|
||||||
else:
|
else:
|
||||||
if (file_project.original_fps == 24):
|
self.command_var.append("-c:a")
|
||||||
self.command_var.append("24000/1001")
|
if file_project.format_pal:
|
||||||
else:
|
self.command_var.append("ac3")
|
||||||
self.command_var.append("30000/1001")
|
else:
|
||||||
self.command_var.append("-pix_fmt")
|
self.command_var.append("mp2")
|
||||||
self.command_var.append("yuv420p")
|
self.command_var.append("-f")
|
||||||
self.command_var.append("-maxrate:v")
|
self.command_var.append("dvd")
|
||||||
if maxrate > 9000000:
|
self.command_var.append("-r")
|
||||||
maxrate = 9000000
|
if file_project.format_pal:
|
||||||
self.command_var.append(str(maxrate))
|
self.command_var.append("25")
|
||||||
self.command_var.append("-minrate:v")
|
else:
|
||||||
if minrate < 1500000:
|
if (file_project.original_fps == 24):
|
||||||
minrate = 1500000
|
self.command_var.append("24000/1001")
|
||||||
self.command_var.append(str(minrate))
|
else:
|
||||||
self.command_var.append("-bufsize")
|
self.command_var.append("30000/1001")
|
||||||
self.command_var.append("1835008")
|
self.command_var.append("-pix_fmt")
|
||||||
self.command_var.append("-packetsize")
|
self.command_var.append("yuv420p")
|
||||||
self.command_var.append("2048")
|
self.command_var.append("-maxrate:v")
|
||||||
self.command_var.append("-muxrate")
|
if maxrate > (devedeng.project.devede_project.dvd_max_bps_base[0] * 1000):
|
||||||
self.command_var.append("10080000")
|
maxrate = devedeng.project.devede_project.dvd_max_bps_base[0] * 1000
|
||||||
self.command_var.append("-ar")
|
self.command_var.append(str(maxrate))
|
||||||
self.command_var.append("48000")
|
self.command_var.append("-minrate:v")
|
||||||
elif (self.config.disc_type=="vcd"):
|
if minrate < (devedeng.project.devede_project.dvd_min_bps * 1000):
|
||||||
vcd = True
|
minrate = devedeng.project.devede_project.dvd_min_bps * 1000
|
||||||
if not file_project.no_reencode_audio_video:
|
self.command_var.append(str(minrate))
|
||||||
self.command_var.append("-c:v")
|
self.command_var.append("-bufsize")
|
||||||
self.command_var.append("mpeg1video")
|
self.command_var.append("1835008")
|
||||||
if not file_project.copy_sound:
|
self.command_var.append("-packetsize")
|
||||||
self.command_var.append("-c:a")
|
self.command_var.append("2048")
|
||||||
self.command_var.append("mp2")
|
self.command_var.append("-muxrate")
|
||||||
self.command_var.append("-b:v")
|
self.command_var.append("10080000")
|
||||||
self.command_var.append("1150000")
|
self.command_var.append("-ar")
|
||||||
self.command_var.append("-b:a")
|
self.command_var.append("48000")
|
||||||
self.command_var.append("224000")
|
elif (self.config.disc_type=="vcd"):
|
||||||
self.command_var.append("-f")
|
vcd = True
|
||||||
self.command_var.append("vcd")
|
if not file_project.no_reencode_audio_video:
|
||||||
self.command_var.append("-r")
|
self.command_var.append("-c:v")
|
||||||
if file_project.format_pal:
|
self.command_var.append("mpeg1video")
|
||||||
self.command_var.append("25")
|
if not file_project.copy_sound:
|
||||||
else:
|
self.command_var.append("-c:a")
|
||||||
if (file_project.original_fps == 24):
|
self.command_var.append("mp2")
|
||||||
self.command_var.append("24000/1001")
|
self.command_var.append("-b:v")
|
||||||
else:
|
self.command_var.append("1150000")
|
||||||
self.command_var.append("30000/1001")
|
self.command_var.append("-b:a")
|
||||||
self.command_var.append("-g")
|
self.command_var.append("224000")
|
||||||
if file_project.format_pal:
|
self.command_var.append("-f")
|
||||||
self.command_var.append("15")
|
self.command_var.append("vcd")
|
||||||
else:
|
self.command_var.append("-r")
|
||||||
self.command_var.append("18")
|
if file_project.format_pal:
|
||||||
self.command_var.append("-s")
|
self.command_var.append("25")
|
||||||
if file_project.format_pal:
|
else:
|
||||||
self.command_var.append("352x288")
|
if (file_project.original_fps == 24):
|
||||||
else:
|
self.command_var.append("24000/1001")
|
||||||
self.command_var.append("352x240")
|
else:
|
||||||
self.command_var.append("-maxrate:v")
|
self.command_var.append("30000/1001")
|
||||||
self.command_var.append("1150000")
|
self.command_var.append("-g")
|
||||||
self.command_var.append("-minrate:v")
|
if file_project.format_pal:
|
||||||
self.command_var.append("1150000")
|
self.command_var.append("15")
|
||||||
self.command_var.append("-bufsize")
|
else:
|
||||||
self.command_var.append("327680")
|
self.command_var.append("18")
|
||||||
self.command_var.append("-packetsize")
|
self.command_var.append("-s")
|
||||||
self.command_var.append("2324")
|
if file_project.format_pal:
|
||||||
self.command_var.append("-muxrate")
|
self.command_var.append("352x288")
|
||||||
self.command_var.append("1411200")
|
else:
|
||||||
self.command_var.append("-ar")
|
self.command_var.append("352x240")
|
||||||
self.command_var.append("44100")
|
self.command_var.append("-maxrate:v")
|
||||||
elif (self.config.disc_type=="svcd") or (self.config.disc_type=="cvd"):
|
self.command_var.append("1150000")
|
||||||
if not file_project.no_reencode_audio_video:
|
self.command_var.append("-minrate:v")
|
||||||
self.command_var.append("-c:v")
|
self.command_var.append("1150000")
|
||||||
self.command_var.append("mpeg2video")
|
self.command_var.append("-bufsize")
|
||||||
if not file_project.copy_sound:
|
self.command_var.append("327680")
|
||||||
self.command_var.append("-c:a")
|
self.command_var.append("-packetsize")
|
||||||
self.command_var.append("mp2")
|
self.command_var.append("2324")
|
||||||
self.command_var.append("-f")
|
self.command_var.append("-muxrate")
|
||||||
self.command_var.append("svcd")
|
self.command_var.append("1411200")
|
||||||
self.command_var.append("-r")
|
self.command_var.append("-ar")
|
||||||
if file_project.format_pal:
|
self.command_var.append("44100")
|
||||||
self.command_var.append("25")
|
elif (self.config.disc_type=="svcd") or (self.config.disc_type=="cvd"):
|
||||||
else:
|
if not file_project.no_reencode_audio_video:
|
||||||
if (file_project.original_fps == 24):
|
self.command_var.append("-c:v")
|
||||||
self.command_var.append("24000/1001")
|
self.command_var.append("mpeg2video")
|
||||||
else:
|
if not file_project.copy_sound:
|
||||||
self.command_var.append("30000/1001")
|
self.command_var.append("-c:a")
|
||||||
self.command_var.append("-g")
|
self.command_var.append("mp2")
|
||||||
if file_project.format_pal:
|
self.command_var.append("-f")
|
||||||
self.command_var.append("12")
|
self.command_var.append("svcd")
|
||||||
else:
|
self.command_var.append("-r")
|
||||||
self.command_var.append("15")
|
if file_project.format_pal:
|
||||||
self.command_var.append("-s")
|
self.command_var.append("25")
|
||||||
if self.config.disc_type == "cvd":
|
else:
|
||||||
if file_project.format_pal:
|
if (file_project.original_fps == 24):
|
||||||
self.command_var.append("352x576")
|
self.command_var.append("24000/1001")
|
||||||
else:
|
else:
|
||||||
self.command_var.append("352x480")
|
self.command_var.append("30000/1001")
|
||||||
else:
|
self.command_var.append("-g")
|
||||||
if file_project.format_pal:
|
if file_project.format_pal:
|
||||||
self.command_var.append("480x576")
|
self.command_var.append("12")
|
||||||
else:
|
else:
|
||||||
self.command_var.append("480x480")
|
self.command_var.append("15")
|
||||||
self.command_var.append("-pix_fmt")
|
self.command_var.append("-s")
|
||||||
self.command_var.append("yuv420p")
|
if self.config.disc_type == "cvd":
|
||||||
self.command_var.append("-maxrate:v")
|
if file_project.format_pal:
|
||||||
if maxrate > 2516000:
|
self.command_var.append("352x576")
|
||||||
maxrate = 2516000
|
else:
|
||||||
self.command_var.append(str(maxrate))
|
self.command_var.append("352x480")
|
||||||
self.command_var.append("-minrate:v")
|
else:
|
||||||
if minrate < 1145000:
|
if file_project.format_pal:
|
||||||
minrate = 1145000
|
self.command_var.append("480x576")
|
||||||
self.command_var.append(str(minrate))
|
else:
|
||||||
self.command_var.append("-bufsize")
|
self.command_var.append("480x480")
|
||||||
self.command_var.append("1835008")
|
self.command_var.append("-pix_fmt")
|
||||||
self.command_var.append("-packetsize")
|
self.command_var.append("yuv420p")
|
||||||
self.command_var.append("2324")
|
self.command_var.append("-maxrate:v")
|
||||||
self.command_var.append("-ar")
|
if maxrate > (devedeng.project.devede_project.svcd_max_bps_base[0] * 1000):
|
||||||
self.command_var.append("44100")
|
maxrate = devedeng.project.devede_project.svcd_max_bps_base[0] * 1000
|
||||||
self.command_var.append("-scan_offset")
|
self.command_var.append(str(maxrate))
|
||||||
self.command_var.append("1")
|
self.command_var.append("-minrate:v")
|
||||||
|
if minrate < (devedeng.project.devede_project.svcd_min_bps * 1000):
|
||||||
|
minrate = (devedeng.project.devede_project.svcd_min_bps * 1000)
|
||||||
|
self.command_var.append(str(minrate))
|
||||||
|
self.command_var.append("-bufsize")
|
||||||
|
self.command_var.append("1835008")
|
||||||
|
self.command_var.append("-packetsize")
|
||||||
|
self.command_var.append("2324")
|
||||||
|
self.command_var.append("-ar")
|
||||||
|
self.command_var.append("44100")
|
||||||
|
self.command_var.append("-scan_offset")
|
||||||
|
self.command_var.append("1")
|
||||||
|
|
||||||
if (not file_project.no_reencode_audio_video):
|
if (not file_project.no_reencode_audio_video):
|
||||||
self.command_var.append("-sn") # no subtitles
|
self.command_var.append("-sn") # no subtitles
|
||||||
|
|
||||||
if file_project.copy_sound or file_project.no_reencode_audio_video:
|
if file_project.copy_sound or file_project.no_reencode_audio_video:
|
||||||
self.command_var.append("-c:a")
|
self.command_var.append("-c:a")
|
||||||
self.command_var.append("copy")
|
self.command_var.append("copy")
|
||||||
|
|
||||||
if file_project.no_reencode_audio_video:
|
if file_project.no_reencode_audio_video:
|
||||||
self.command_var.append("-c:v")
|
self.command_var.append("-c:v")
|
||||||
self.command_var.append("copy")
|
self.command_var.append("copy")
|
||||||
|
|
||||||
if (not vcd):
|
if (not vcd):
|
||||||
if not file_project.format_pal:
|
if not file_project.format_pal:
|
||||||
if (file_project.original_fps==24) and ((self.config.disc_type=="dvd")):
|
if (file_project.original_fps==24) and ((self.config.disc_type=="dvd")):
|
||||||
keyintv=15
|
keyintv=15
|
||||||
else:
|
else:
|
||||||
keyintv=18
|
keyintv=18
|
||||||
else:
|
else:
|
||||||
keyintv=15
|
keyintv=15
|
||||||
|
|
||||||
if (not file_project.gop12) and (not(self.config.disc_type == "divx")) and (not(self.config.disc_type == "mkv")):
|
if (not file_project.gop12) and (not(self.config.disc_type == "divx")) and (not(self.config.disc_type == "mkv")):
|
||||||
self.command_var.append("-g")
|
self.command_var.append("-g")
|
||||||
self.command_var.append(str(keyintv))
|
self.command_var.append(str(keyintv))
|
||||||
|
|
||||||
if (self.config.disc_type=="divx") or (self.config.disc_type=="mkv"):
|
if (self.config.disc_type=="divx") or (self.config.disc_type=="mkv"):
|
||||||
self.command_var.append("-g")
|
self.command_var.append("-g")
|
||||||
self.command_var.append("300")
|
self.command_var.append("300")
|
||||||
elif file_project.gop12 and (not file_project.no_reencode_audio_video):
|
elif file_project.gop12 and (not file_project.no_reencode_audio_video):
|
||||||
self.command_var.append("-g")
|
self.command_var.append("-g")
|
||||||
self.command_var.append("12")
|
self.command_var.append("12")
|
||||||
|
|
||||||
self.command_var.append("-bf")
|
self.command_var.append("-bf")
|
||||||
self.command_var.append("2")
|
self.command_var.append("2")
|
||||||
self.command_var.append("-strict")
|
self.command_var.append("-strict")
|
||||||
self.command_var.append("1")
|
self.command_var.append("1")
|
||||||
|
|
||||||
if video_length != 0:
|
if video_length != 0:
|
||||||
self.command_var.append("-t")
|
self.command_var.append("-t")
|
||||||
self.command_var.append(str(video_length))
|
self.command_var.append(str(video_length))
|
||||||
|
|
||||||
self.command_var.append("-ac")
|
self.command_var.append("-ac")
|
||||||
if (file_project.sound5_1) and ((self.config.disc_type=="dvd") or (self.config.disc_type=="divx") or (self.config.disc_type=="mkv")):
|
if (file_project.sound5_1) and ((self.config.disc_type=="dvd") or (self.config.disc_type=="divx") or (self.config.disc_type=="mkv")):
|
||||||
self.command_var.append("6")
|
self.command_var.append("6")
|
||||||
else:
|
else:
|
||||||
self.command_var.append("2")
|
self.command_var.append("2")
|
||||||
|
|
||||||
self.command_var.append("-aspect")
|
self.command_var.append("-aspect")
|
||||||
self.command_var.append(str(file_project.aspect_ratio_final))
|
self.command_var.append(str(file_project.aspect_ratio_final))
|
||||||
|
|
||||||
if self.config.disc_type=="divx":
|
if self.config.disc_type=="divx":
|
||||||
self.command_var.append("-vtag")
|
self.command_var.append("-vtag")
|
||||||
self.command_var.append("DX50")
|
self.command_var.append("DX50")
|
||||||
|
|
||||||
if (file_project.deinterlace == "deinterlace_ffmpeg") and (file_project.no_reencode_audio_video==False) and second_pass:
|
if (file_project.deinterlace == "deinterlace_ffmpeg") and (file_project.no_reencode_audio_video==False) and second_pass:
|
||||||
self.command_var.append("-deinterlace")
|
self.command_var.append("-deinterlace")
|
||||||
|
|
||||||
if (file_project.no_reencode_audio_video==False) and (vcd==False) and second_pass:
|
if (file_project.no_reencode_audio_video==False) and (vcd==False) and second_pass:
|
||||||
self.command_var.append("-s")
|
self.command_var.append("-s")
|
||||||
self.command_var.append(str(file_project.width_final)+"x"+str(file_project.height_final))
|
self.command_var.append(str(file_project.width_final)+"x"+str(file_project.height_final))
|
||||||
|
|
||||||
if second_pass:
|
if second_pass:
|
||||||
self.command_var.append("-trellis")
|
self.command_var.append("-trellis")
|
||||||
self.command_var.append("1")
|
self.command_var.append("1")
|
||||||
self.command_var.append("-mbd")
|
self.command_var.append("-mbd")
|
||||||
self.command_var.append("2")
|
self.command_var.append("2")
|
||||||
else:
|
else:
|
||||||
self.command_var.append("-trellis")
|
self.command_var.append("-trellis")
|
||||||
self.command_var.append("0")
|
self.command_var.append("0")
|
||||||
self.command_var.append("-mbd")
|
self.command_var.append("-mbd")
|
||||||
self.command_var.append("0")
|
self.command_var.append("0")
|
||||||
|
|
||||||
if (vcd == False) and (file_project.no_reencode_audio_video == False):
|
if (vcd == False) and (file_project.no_reencode_audio_video == False):
|
||||||
self.command_var.append("-b:a")
|
self.command_var.append("-b:a")
|
||||||
self.command_var.append(str(file_project.audio_rate_final)+"k")
|
self.command_var.append(str(file_project.audio_rate_final)+"k")
|
||||||
|
|
||||||
self.command_var.append("-b:v")
|
self.command_var.append("-b:v")
|
||||||
self.command_var.append(str(file_project.video_rate_final)+"k")
|
self.command_var.append(str(file_project.video_rate_final)+"k")
|
||||||
|
|
||||||
if file_project.two_pass_encoding == True:
|
if file_project.two_pass_encoding == True:
|
||||||
self.command_var.append("-passlogfile")
|
self.command_var.append("-passlogfile")
|
||||||
self.command_var.append(output_file)
|
self.command_var.append(output_file)
|
||||||
self.command_var.append("-pass")
|
self.command_var.append("-pass")
|
||||||
if pass2:
|
if pass2:
|
||||||
self.command_var.append("2")
|
self.command_var.append("2")
|
||||||
else:
|
else:
|
||||||
self.command_var.append("1")
|
self.command_var.append("1")
|
||||||
|
|
||||||
self.command_var.append(output_file)
|
self.command_var.append(output_file)
|
||||||
|
|
||||||
|
|
||||||
def create_menu_mpeg(self,n_page,background_music,sound_length,pal,video_rate, audio_rate,output_path, use_mp2):
|
def create_menu_mpeg(self,n_page,background_music,sound_length,pal,video_rate, audio_rate,output_path, use_mp2):
|
||||||
|
|
||||||
self.n_page = n_page
|
self.n_page = n_page
|
||||||
self.final_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=[]
|
||||||
self.command_var.append("ffmpeg")
|
self.command_var.append("ffmpeg")
|
||||||
|
|
||||||
self.command_var.append("-loop")
|
self.command_var.append("-loop")
|
||||||
self.command_var.append("1")
|
self.command_var.append("1")
|
||||||
|
|
||||||
self.command_var.append("-f")
|
self.command_var.append("-f")
|
||||||
self.command_var.append("image2")
|
self.command_var.append("image2")
|
||||||
self.command_var.append("-i")
|
self.command_var.append("-i")
|
||||||
self.command_var.append(os.path.join(output_path,"menu_"+str(n_page)+"_bg.png"))
|
self.command_var.append(os.path.join(output_path,"menu_"+str(n_page)+"_bg.png"))
|
||||||
self.command_var.append("-i")
|
self.command_var.append("-i")
|
||||||
self.command_var.append(background_music)
|
self.command_var.append(background_music)
|
||||||
|
|
||||||
self.command_var.append("-y")
|
self.command_var.append("-y")
|
||||||
self.command_var.append("-target")
|
self.command_var.append("-target")
|
||||||
if pal:
|
if pal:
|
||||||
self.command_var.append("pal-dvd")
|
self.command_var.append("pal-dvd")
|
||||||
else:
|
else:
|
||||||
self.command_var.append("ntsc-dvd")
|
self.command_var.append("ntsc-dvd")
|
||||||
self.command_var.append("-acodec")
|
self.command_var.append("-acodec")
|
||||||
if use_mp2:
|
if use_mp2:
|
||||||
self.command_var.append("mp2")
|
self.command_var.append("mp2")
|
||||||
else:
|
else:
|
||||||
self.command_var.append("ac3")
|
self.command_var.append("ac3")
|
||||||
self.command_var.append("-s")
|
self.command_var.append("-s")
|
||||||
if pal:
|
if pal:
|
||||||
self.command_var.append("720x576")
|
self.command_var.append("720x576")
|
||||||
else:
|
else:
|
||||||
self.command_var.append("720x480")
|
self.command_var.append("720x480")
|
||||||
self.command_var.append("-g")
|
self.command_var.append("-g")
|
||||||
self.command_var.append("12")
|
self.command_var.append("12")
|
||||||
self.command_var.append("-b:v")
|
self.command_var.append("-b:v")
|
||||||
self.command_var.append(str(video_rate)+"k")
|
self.command_var.append(str(video_rate)+"k")
|
||||||
self.command_var.append("-b:a")
|
self.command_var.append("-b:a")
|
||||||
self.command_var.append(str(audio_rate)+"k")
|
self.command_var.append(str(audio_rate)+"k")
|
||||||
self.command_var.append("-aspect")
|
self.command_var.append("-aspect")
|
||||||
self.command_var.append("4:3")
|
self.command_var.append("4:3")
|
||||||
|
|
||||||
self.command_var.append("-t")
|
self.command_var.append("-t")
|
||||||
self.command_var.append(str(1+sound_length))
|
self.command_var.append(str(1+sound_length))
|
||||||
|
|
||||||
movie_path = os.path.join(output_path,"menu_"+str(n_page)+".mpg")
|
movie_path = os.path.join(output_path,"menu_"+str(n_page)+".mpg")
|
||||||
self.command_var.append(movie_path)
|
self.command_var.append(movie_path)
|
||||||
|
|
||||||
muxer = devedeng.mux_dvd_menu.mux_dvd_menu()
|
muxer = devedeng.mux_dvd_menu.mux_dvd_menu()
|
||||||
final_path = muxer.create_mpg(n_page,output_path,movie_path)
|
final_path = muxer.create_mpg(n_page,output_path,movie_path)
|
||||||
# the muxer process depends of the converter process
|
# the muxer process depends of the converter process
|
||||||
muxer.add_dependency(self)
|
muxer.add_dependency(self)
|
||||||
self.add_child_process(muxer)
|
self.add_child_process(muxer)
|
||||||
|
|
||||||
return (final_path)
|
return (final_path)
|
||||||
|
|
||||||
def process_stdout(self,data):
|
def process_stdout(self,data):
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
def process_stderr(self,data):
|
def process_stderr(self,data):
|
||||||
|
|
||||||
pos = data[0].find("time=")
|
pos = data[0].find("time=")
|
||||||
if (pos != -1):
|
if (pos != -1):
|
||||||
pos+=5
|
pos+=5
|
||||||
pos2 = data[0].find(" ",pos)
|
pos2 = data[0].find(" ",pos)
|
||||||
if (pos2 != -1):
|
if (pos2 != -1):
|
||||||
parts = data[0][pos:pos2].split(":")
|
parts = data[0][pos:pos2].split(":")
|
||||||
t = 0.0
|
t = 0.0
|
||||||
for e in parts:
|
for e in parts:
|
||||||
t *= 60.0
|
t *= 60.0
|
||||||
t += float(e)
|
t += float(e)
|
||||||
t /= self.final_length
|
t /= self.final_length
|
||||||
self.progress_bar[1].set_fraction(t)
|
self.progress_bar[1].set_fraction(t)
|
||||||
self.progress_bar[1].set_text("%.1f%%" % (100.0 * t))
|
self.progress_bar[1].set_text("%.1f%%" % (100.0 * t))
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,26 @@ import devedeng.help
|
||||||
|
|
||||||
class devede_project:
|
class devede_project:
|
||||||
|
|
||||||
|
dvd_max_bps_base = {0: 9000}
|
||||||
|
dvd_min_bps = 300
|
||||||
|
dvd_max_total = 10000
|
||||||
|
|
||||||
|
svcd_max_bps_base = {0: 2700}
|
||||||
|
svcd_min_bps = 200
|
||||||
|
svcd_max_total = 2700
|
||||||
|
|
||||||
|
divx_max_bps_base = {0: 4854, 720: 9708, 1080: 20000}
|
||||||
|
divx_min_bps = 300
|
||||||
|
divx_max_total = -1
|
||||||
|
|
||||||
|
mkv_max_bps_base = {0: 192, 240: 2000, 480: 14000, 720: 50000, 1080: 240000}
|
||||||
|
mkv_min_bps = 192
|
||||||
|
mkv_max_total = -1
|
||||||
|
|
||||||
|
def_max_bps_base = {0: 9000}
|
||||||
|
def_min_bps = 300
|
||||||
|
def_max_total = -1
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
|
||||||
self.config = devedeng.configuration_data.configuration.get_config()
|
self.config = devedeng.configuration_data.configuration.get_config()
|
||||||
|
|
@ -344,25 +364,25 @@ class devede_project:
|
||||||
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_base = {0: 9000}
|
max_bps_base = devede_project.dvd_max_bps_base.copy()
|
||||||
min_bps = 300
|
min_bps = devede_project.dvd_min_bps
|
||||||
max_total = 10000
|
max_total = devede_project.dvd_max_total
|
||||||
elif (self.disc_type == "svcd") or (self.disc_type == "cvd"):
|
elif (self.disc_type == "svcd") or (self.disc_type == "cvd"):
|
||||||
max_bps_base = {0: 2700}
|
max_bps_base = devede_project.svcd_max_bps_base.copy()
|
||||||
min_bps = 200
|
min_bps = devede_project.svcd_min_bps
|
||||||
max_total = 2700
|
max_total = devede_project.svcd_max_total
|
||||||
elif (self.disc_type == "divx"):
|
elif (self.disc_type == "divx"):
|
||||||
max_bps_base = {0: 4854, 720: 9708, 1080: 20000}
|
max_bps_base = devede_project.divx_max_bps_base.copy()
|
||||||
min_bps = 300
|
min_bps = devede_project.divx_min_bps
|
||||||
max_total = -1
|
max_total = devede_project.divx_max_total
|
||||||
elif (self.disc_type == "mkv"):
|
elif (self.disc_type == "mkv"):
|
||||||
max_bps_base = {0: 192, 240: 2000, 480: 14000, 720: 50000, 1080: 240000}
|
max_bps_base = devede_project.mkv_max_bps_base.copy()
|
||||||
min_bps = 192
|
min_bps = devede_project.mkv_min_bps
|
||||||
max_total = -1
|
max_total = devede_project.mkv_max_total
|
||||||
else:
|
else:
|
||||||
max_bps_base = {0: 9000}
|
max_bps_base = devede_project.def_max_bps_base.copy()
|
||||||
min_bps = 300
|
min_bps = devede_project.def_min_bps
|
||||||
max_total = -1
|
max_total = devede_project.def_max_total
|
||||||
|
|
||||||
if (total_resolution != 0):
|
if (total_resolution != 0):
|
||||||
remaining_disc_size = ((8000.0 * self.get_dvd_size()[0]) - fixed_size) # in kbits
|
remaining_disc_size = ((8000.0 * self.get_dvd_size()[0]) - fixed_size) # in kbits
|
||||||
|
|
@ -539,8 +559,14 @@ class devede_project:
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
counter = 0
|
counter = 0
|
||||||
|
if self.disc_type == "divx":
|
||||||
|
extension = "avi"
|
||||||
|
elif self.disc_type == "mkv":
|
||||||
|
extension = "mkv"
|
||||||
|
else:
|
||||||
|
extension = "mpg"
|
||||||
for movie in file_movies:
|
for movie in file_movies:
|
||||||
p = movie.do_conversion(os.path.join(movie_folder,"movie_"+str(counter)+".mpg"))
|
p = movie.do_conversion(os.path.join(movie_folder,"movie_{:d}.{:s}".format(counter,extension)))
|
||||||
run_window.add_process(p)
|
run_window.add_process(p)
|
||||||
final_dependencies.append(p)
|
final_dependencies.append(p)
|
||||||
counter += 1
|
counter += 1
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue