Exemplo n.º 1
0
    def do_conversion(self, output_path, duration=0):

        self.converted_filename = output_path
        if self.is_mpeg_ps:
            converter = devedeng.file_copy.file_copy(self.file_name, output_path)
        else:
            self.set_final_size_aspect()
            self.set_final_rates()

            cv = devedeng.converter.converter.get_converter()
            disc_converter = cv.get_disc_converter()
            converter = disc_converter()
            converter.convert_file(self, output_path, duration)

        if len(self.subtitles_list) != 0:
            last_process = converter
            # if duration == 0:
            # it seems that SPUMUX always fills the entire subtitles
            duration2 = self.original_length
            # else:
            #    duration2 = duration
            stream_id = 0
            for subt in self.subtitles_list:
                subt_file = subt[0]
                subt_codepage = subt[1]
                subt_lang = subt[2]
                subt_upper = subt[3]
                if self.aspect_ratio_final >= 1.7:
                    final_aspect = "16:9"
                else:
                    final_aspect = "4:3"
                subt_mux = devedeng.subtitles_mux.subtitles_mux()
                subt_mux.multiplex_subtitles(
                    output_path,
                    subt_file,
                    subt_codepage,
                    subt_lang,
                    subt_upper,
                    self.subt_font_size,
                    self.format_pal,
                    self.force_subtitles,
                    final_aspect,
                    duration2,
                    stream_id,
                    self.subt_fill_color,
                    self.subt_outline_color,
                    self.subt_thickness,
                )
                subt_mux.add_dependency(last_process)
                converter.add_child_process(subt_mux)
                last_process = subt_mux
                stream_id += 1

        return converter
Exemplo n.º 2
0
    def do_conversion(self, output_path, duration=0):

        self.converted_filename = output_path
        if self.is_mpeg_ps:
            converter = devedeng.file_copy.file_copy(self.file_name,
                                                     output_path)
        else:
            self.set_final_size_aspect()
            self.set_final_rates()

            cv = devedeng.converter.converter.get_converter()
            disc_converter = cv.get_disc_converter()
            converter = disc_converter()
            converter.convert_file(self, output_path, duration)

        if len(self.subtitles_list) != 0:
            last_process = converter
            # if duration == 0:
            # it seems that SPUMUX always fills the entire subtitles
            duration2 = self.original_length
            # else:
            #    duration2 = duration
            stream_id = 0
            for subt in self.subtitles_list:
                subt_file = subt[0]
                subt_codepage = subt[1]
                subt_lang = subt[2]
                subt_upper = subt[3]
                if self.aspect_ratio_final >= 1.7:
                    final_aspect = "16:9"
                else:
                    final_aspect = "4:3"
                subt_mux = devedeng.subtitles_mux.subtitles_mux()
                subt_mux.multiplex_subtitles(
                    output_path, subt_file, subt_codepage, subt_lang,
                    subt_upper, self.subt_font_size, self.format_pal,
                    self.force_subtitles, final_aspect, duration2, stream_id,
                    self.subt_fill_color, self.subt_outline_color,
                    self.subt_thickness)
                subt_mux.add_dependency(last_process)
                converter.add_child_process(subt_mux)
                last_process = subt_mux
                stream_id += 1

        return converter