diff --git a/README.md b/README.md index 5e604d6..c1f9214 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ and can use only FFMpeg or AVConv for video conversion. The current visible changes are quite small in number: * Now allows to add several files at once -* Now make better use of multicore systems by parallelizing the conversion of several movie files +* Now makes better use of multicore systems by parallelizing the conversion of several movie files * The menu edition is interactive * Has a new "cut" resizing method, to allow to store as widescreen movies with black bars * Allows to create Matroska files with H.264 video and MP3 audio @@ -37,15 +37,20 @@ The current visible changes are quite small in number: Some of the future ideas to add to Devede NG are, without an specific order: * allow to set properties for several files in one step -* add support for two-pass encoding * add more backends * add more output formats * allow to replace the movie's audio track with one or several MP3 or OGG audio files ## History of versions ## +* version XXXXX + * Added two-pass conversion + * Now detects separately MKISOFS and GENISOIMAGE, allowing to have only one of them installed in the system + * Now checks that the number of files is smaller than the limit for DVD projects + * Now uses GLib for DBus instead of python-dbus + * Fixed the DESKTOP file to ensure that an icon is shown in the applications menu * version 0.1 alpha 1 (2014-08-06) - + * First public version ## CONTACTING THE AUTHOR ## diff --git a/data/interface/wprogress.ui b/data/interface/wprogress.ui index ec789cf..e8956be 100644 --- a/data/interface/wprogress.ui +++ b/data/interface/wprogress.ui @@ -56,17 +56,10 @@ 0 none - + True False - 12 - - - True - False - True - - + True diff --git a/src/devede/avconv_converter.py b/src/devede/avconv_converter.py index e878f0a..3a0f8a4 100644 --- a/src/devede/avconv_converter.py +++ b/src/devede/avconv_converter.py @@ -105,9 +105,30 @@ class avconv_converter(devede.executor.executor): devede.executor.executor.__init__(self) self.config = devede.configuration_data.configuration.get_config() - def convert_file(self,file_project,output_file,video_length): + def convert_file(self,file_project,output_file,video_length,pass2 = False): - self.text = _("Converting %(X)s") % {"X" : file_project.title_name} + if file_project.two_pass_encoding: + if pass2: + self.text = _("Converting %(X)s (pass 2)") % {"X" : file_project.title_name} + else: + self.text = _("Converting %(X)s (pass 1)") % {"X" : file_project.title_name} + # Prepare the converting process for the second pass + tmp = devede.avconv_converter.avconv_converter() + tmp.convert_file(file_project, output_file, video_length, True) + # it deppends of this process + tmp.add_dependency(self) + # add it as a child process of this one + self.add_child_process(tmp) + else: + self.text = _("Converting %(X)s") % {"X" : file_project.title_name} + + if (pass2 == False) and (file_project.two_pass_encoding == True): + # this is the first pass in a 2-pass codification + second_pass = False + else: + # 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 + second_pass = True if (video_length == 0): self.final_length = file_project.original_length @@ -118,11 +139,11 @@ class avconv_converter(devede.executor.executor): self.command_var.append("-i") self.command_var.append(file_project.file_name) - if (file_project.volume!=100): + if (file_project.volume!=100) and second_pass: 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): + 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(str(file_project.audio_delay)) @@ -135,7 +156,7 @@ class avconv_converter(devede.executor.executor): self.command_var.append("-map") self.command_var.append("0"+":"+str(l+1)) - if (file_project.no_reencode_audio_video==False): + if (file_project.no_reencode_audio_video==False) and second_pass: cmd_line="" if file_project.deinterlace=="deinterlace_yadif": @@ -218,8 +239,9 @@ class avconv_converter(devede.executor.executor): else: self.command_var.append("pal-dvd") if (not file_project.copy_sound): - self.command_var.append("-acodec") - self.command_var.append("ac3") + if file_project.sound5_1: + self.command_var.append("-acodec") + self.command_var.append("ac3") elif (self.config.disc_type=="vcd"): vcd=True if not file_project.format_pal: @@ -243,14 +265,6 @@ class avconv_converter(devede.executor.executor): 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") @@ -298,18 +312,23 @@ class avconv_converter(devede.executor.executor): self.command_var.append("-vtag") self.command_var.append("DX50") - if (file_project.deinterlace == "deinterlace_ffmpeg") and (file_project.no_reencode_audio_video==False): + if (file_project.deinterlace == "deinterlace_ffmpeg") and (file_project.no_reencode_audio_video==False) and second_pass: self.command_var.append("-deinterlace") - if (file_project.no_reencode_audio_video==False) and (vcd==False): + if (file_project.no_reencode_audio_video==False) and (vcd==False) and second_pass: 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 second_pass: + self.command_var.append("-trellis") + self.command_var.append("1") + self.command_var.append("-mbd") + self.command_var.append("2") + else: + self.command_var.append("-trellis") + self.command_var.append("0") + self.command_var.append("-mbd") + self.command_var.append("0") if (vcd == False) and (file_project.no_reencode_audio_video == False): self.command_var.append("-b:a") @@ -318,8 +337,16 @@ class avconv_converter(devede.executor.executor): self.command_var.append("-b:v") self.command_var.append(str(file_project.video_rate_final)+"k") - self.command_var.append(output_file) + if file_project.two_pass_encoding == True: + self.command_var.append("-passlogfile") + self.command_var.append(output_file) + self.command_var.append("-pass") + if pass2: + self.command_var.append("2") + else: + self.command_var.append("1") + self.command_var.append(output_file) def create_menu_mpeg(self,n_page,background_music,sound_length,pal,video_rate, audio_rate,output_path): @@ -388,6 +415,11 @@ class avconv_converter(devede.executor.executor): pos+=5 pos2 = data[0].find(" ",pos) if (pos2 != -1): - t = float(data[0][pos:pos2]) / self.final_length + parts = data[0][pos:pos2].split(":") + t = 0.0 + for e in parts: + t *= 60.0 + t += float(e) + t /= self.final_length self.progress_bar[1].set_fraction(t) self.progress_bar[1].set_text("%.1f%%" % (100.0 * t)) \ No newline at end of file diff --git a/src/devede/ffmpeg_converter.py b/src/devede/ffmpeg_converter.py index 87be1e5..b4d0ec4 100644 --- a/src/devede/ffmpeg_converter.py +++ b/src/devede/ffmpeg_converter.py @@ -105,9 +105,30 @@ class ffmpeg_converter(devede.executor.executor): devede.executor.executor.__init__(self) self.config = devede.configuration_data.configuration.get_config() - def convert_file(self,file_project,output_file,video_length): + def convert_file(self,file_project,output_file,video_length,pass2 = False): - self.text = _("Converting %(X)s") % {"X" : file_project.title_name} + if file_project.two_pass_encoding: + if pass2: + self.text = _("Converting %(X)s (pass 2)") % {"X" : file_project.title_name} + else: + self.text = _("Converting %(X)s (pass 1)") % {"X" : file_project.title_name} + # Prepare the converting process for the second pass + tmp = devede.avconv_converter.avconv_converter() + tmp.convert_file(file_project, output_file, video_length, True) + # it deppends of this process + tmp.add_dependency(self) + # add it as a child process of this one + self.add_child_process(tmp) + else: + self.text = _("Converting %(X)s") % {"X" : file_project.title_name} + + if (pass2 == False) and (file_project.two_pass_encoding == True): + # this is the first pass in a 2-pass codification + second_pass = False + else: + # 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 + second_pass = True if (video_length == 0): self.final_length = file_project.original_length @@ -118,11 +139,11 @@ class ffmpeg_converter(devede.executor.executor): self.command_var.append("-i") self.command_var.append(file_project.file_name) - if (file_project.volume!=100): + if (file_project.volume!=100) and second_pass: 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): + 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(str(file_project.audio_delay)) @@ -135,7 +156,7 @@ class ffmpeg_converter(devede.executor.executor): self.command_var.append("-map") self.command_var.append("0"+":"+str(l+1)) - if (file_project.no_reencode_audio_video==False): + if (file_project.no_reencode_audio_video==False) and second_pass: cmd_line="" if file_project.deinterlace=="deinterlace_yadif": @@ -218,8 +239,9 @@ class ffmpeg_converter(devede.executor.executor): else: self.command_var.append("pal-dvd") if (not file_project.copy_sound): - self.command_var.append("-acodec") - self.command_var.append("ac3") + if file_project.sound5_1: + self.command_var.append("-acodec") + self.command_var.append("ac3") elif (self.config.disc_type=="vcd"): vcd=True if not file_project.format_pal: @@ -290,18 +312,23 @@ class ffmpeg_converter(devede.executor.executor): self.command_var.append("-vtag") self.command_var.append("DX50") - if (file_project.deinterlace == "deinterlace_ffmpeg") and (file_project.no_reencode_audio_video==False): + if (file_project.deinterlace == "deinterlace_ffmpeg") and (file_project.no_reencode_audio_video==False) and second_pass: self.command_var.append("-deinterlace") - if (file_project.no_reencode_audio_video==False) and (vcd==False): + if (file_project.no_reencode_audio_video==False) and (vcd==False) and second_pass: 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 second_pass: + self.command_var.append("-trellis") + self.command_var.append("1") + self.command_var.append("-mbd") + self.command_var.append("2") + else: + self.command_var.append("-trellis") + self.command_var.append("0") + self.command_var.append("-mbd") + self.command_var.append("0") if (vcd == False) and (file_project.no_reencode_audio_video == False): self.command_var.append("-b:a") @@ -310,8 +337,16 @@ class ffmpeg_converter(devede.executor.executor): self.command_var.append("-b:v") self.command_var.append(str(file_project.video_rate_final)+"k") - self.command_var.append(output_file) + if file_project.two_pass_encoding == True: + self.command_var.append("-passlogfile") + self.command_var.append(output_file) + self.command_var.append("-pass") + if pass2: + self.command_var.append("2") + else: + self.command_var.append("1") + self.command_var.append(output_file) def create_menu_mpeg(self,n_page,background_music,sound_length,pal,video_rate, audio_rate,output_path): diff --git a/src/devede/file_movie.py b/src/devede/file_movie.py index 9132e23..c096b0e 100644 --- a/src/devede/file_movie.py +++ b/src/devede/file_movie.py @@ -58,7 +58,7 @@ class file_movie(devede.interface_manager.interface_manager): self.add_toggle("force_subtitles", False) self.add_toggle("mirror_horizontal", False) self.add_toggle("mirror_vertical", False) - self.add_toggle("two_pass_encoding", True) + self.add_toggle("two_pass_encoding", False) self.add_toggle("sound5_1", False) self.add_toggle("copy_sound", False) self.add_toggle("is_mpeg_ps", False)