def load(tokens): try: clip_path = tokens[1] except: return ERROR + " malformed command " + LOAD + NEW_LINE if os.path.isfile(clip_path) == False: return ERROR + "file does not exist, path:" + clip_path + NEW_LINE profile_index = get_clip_profile_index(clip_path) clip_profile = mltprofiles.get_profile_for_index(profile_index) clip_producer = mlt.Producer(clip_profile, str(clip_path)) frame_source = FrameSourceClip(clip_path, clip_producer, clip_profile) _frame_sources[frame_source.md5id] = frame_source print "Created producer for", clip_path, "using profile", clip_profile.description() frames_folder = get_frames_folder_for_frame_source(frame_source) if not os.path.exists(frames_folder): print "Created new folder " + frames_folder os.mkdir(frames_folder) return frame_source.md5id + " " + str(frame_source.length) + NEW_LINE
def _out_profile_changed(): selected_index = widgets.profile_panel.out_profile_combo.widget.get_active() if selected_index == 0: _fill_info_box(current_sequence().profile) else: profile = mltprofiles.get_profile_for_index(selected_index - 1) _fill_info_box(profile)
def set_current_profile(clip_path): profile = mltprofiles.get_default_profile() producer = mlt.Producer(profile, str(clip_path)) global _current_profile profile_index = mltprofiles.get_closest_matching_profile_index(utils.get_file_producer_info(producer)) _current_profile = mltprofiles.get_profile_for_index(profile_index) return profile_index
def get_current_profile(): profile_index = widgets.profile_panel.out_profile_combo.widget.get_active() if profile_index == 0: # project_profile is first selection in combo box profile = PROJECT().profile else: profile = mltprofiles.get_profile_for_index(profile_index - 1) return profile
def _change_project_profile_to_match_media_callback(dialog, response_id, match_profile_index, out_folder, project_name_entry): if response_id == Gtk.ResponseType.ACCEPT: folder = "/" + out_folder.get_uri().lstrip("file:/") name = project_name_entry.get_text() profile = mltprofiles.get_profile_for_index(match_profile_index) path = folder + "/" + name persistance.save_project(PROJECT(), path, profile.description()) #<----- HERE dialog.destroy() else: dialog.destroy()
def _not_matching_media_info_callback(dialog, response_id, media_file): dialog.destroy() if response_id == Gtk.ResponseType.ACCEPT: # Save in hidden and open match_profile_index = mltprofiles.get_closest_matching_profile_index(media_file.info) profile = mltprofiles.get_profile_for_index(match_profile_index) path = utils.get_hidden_user_dir_path() + "/" + PROJECT().name persistance.save_project(PROJECT(), path, profile.description()) #<----- HERE actually_load_project(path)
def _finish_clip_open(): new_profile_index = gmicplayer.set_current_profile(_current_path) new_profile = mltprofiles.get_profile_for_index(new_profile_index) global _current_dimensions, _current_fps, _current_profile_index _current_dimensions = (new_profile.width(), new_profile.height(), 1.0) _current_fps = float(new_profile.frame_rate_num())/float(new_profile.frame_rate_den()) _current_profile_index = new_profile_index global _player, _frame_writer _player = gmicplayer.GmicPlayer(_current_path) _frame_writer = gmicplayer.PreviewFrameWriter(_current_path) _window.set_fps() _window.init_for_new_clip(_current_path, new_profile.description()) _window.set_monitor_sizes() _window.set_widgets_sensitive(True) _window.render_button.set_sensitive(False) _window.encode_desc.set_markup("<small>" + _("not set") + "</small>") _player.create_sdl_consumer() _player.connect_and_start()
def _render_frame_buffer_clip_dialog_callback(dialog, response_id, fb_widgets, media_file): if response_id == Gtk.ResponseType.ACCEPT: # speed, filename folder speed = float(int(fb_widgets.hslider.get_value())) / 100.0 file_name = fb_widgets.file_name.get_text() filenames = fb_widgets.out_folder.get_filenames() folder = filenames[0] write_file = folder + "/"+ file_name + fb_widgets.extension_label.get_text() if os.path.exists(write_file): primary_txt = _("A File with given path exists!") secondary_txt = _("It is not allowed to render Motion Files with same paths as existing files.\nSelect another name for file.") dialogutils.warning_message(primary_txt, secondary_txt, dialog) return # Profile profile_index = fb_widgets.out_profile_combo.get_active() if profile_index == 0: # project_profile is first selection in combo box profile = PROJECT().profile else: profile = mltprofiles.get_profile_for_index(profile_index - 1) # Render consumer properties encoding_option_index = fb_widgets.encodings_cb.get_active() quality_option_index = fb_widgets.quality_cb.get_active() # Range range_selection = fb_widgets.render_range.get_active() dialog.destroy() # Create motion producer fr_path = "framebuffer:" + media_file.path + "?" + str(speed) motion_producer = mlt.Producer(profile, None, str(fr_path)) mltrefhold.hold_ref(motion_producer) # Create sequence and add motion producer into it seq = sequence.Sequence(profile) seq.create_default_tracks() track = seq.tracks[seq.first_video_index] track.append(motion_producer, 0, motion_producer.get_length() - 1) print "motion clip render starting..." consumer = renderconsumer.get_render_consumer_for_encoding_and_quality(write_file, profile, encoding_option_index, quality_option_index) # start and end frames start_frame = 0 end_frame = motion_producer.get_length() - 1 wait_for_producer_stop = True if range_selection == 1: start_frame = int(float(media_file.mark_in) * (1.0 / speed)) end_frame = int(float(media_file.mark_out + 1) * (1.0 / speed)) + int(1.0 / speed) #+ 40 # I'm unable to get this frame perfect. # +40 is to make sure rendering stops after mark out. if end_frame > motion_producer.get_length() - 1: end_frame = motion_producer.get_length() - 1 wait_for_producer_stop = False # consumer wont stop automatically and needs to stopped explicitly # Launch render global motion_renderer, motion_progress_update motion_renderer = renderconsumer.FileRenderPlayer(write_file, seq.tractor, consumer, start_frame, end_frame) motion_renderer.wait_for_producer_end_stop = wait_for_producer_stop motion_renderer.start() title = _("Rendering Motion Clip") text = "<b>Motion Clip File: </b>" + write_file progress_bar = Gtk.ProgressBar() dialog = rendergui.clip_render_progress_dialog(_FB_render_stop, title, text, progress_bar, gui.editor_window.window) motion_progress_update = renderconsumer.ProgressWindowThread(dialog, progress_bar, motion_renderer, _FB_render_stop) motion_progress_update.start() else: dialog.destroy()
def _render_reverse_clip_dialog_callback(dialog, response_id, fb_widgets, media_file): if response_id == Gtk.ResponseType.ACCEPT: # speed, filename folder speed = float(int(fb_widgets.hslider.get_value())) / 100.0 file_name = fb_widgets.file_name.get_text() filenames = fb_widgets.out_folder.get_filenames() folder = filenames[0] write_file = folder + "/" + file_name + fb_widgets.extension_label.get_text( ) if os.path.exists(write_file): primary_txt = _("A File with given path exists!") secondary_txt = _( "It is not allowed to render Motion Files with same paths as existing files.\nSelect another name for file." ) dialogutils.warning_message(primary_txt, secondary_txt, dialog) return # Profile profile_index = fb_widgets.out_profile_combo.get_active() if profile_index == 0: # project_profile is first selection in combo box profile = PROJECT().profile else: profile = mltprofiles.get_profile_for_index(profile_index - 1) # Render consumer properties encoding_option_index = fb_widgets.encodings_cb.get_active() quality_option_index = fb_widgets.quality_cb.get_active() # Range range_selection = fb_widgets.render_range.get_active() dialog.destroy() # Create motion producer source_path = media_file.path if media_file.is_proxy_file == True: source_path = media_file.second_file_path motion_producer = mlt.Producer( profile, None, str("timewarp:" + str(speed) + ":" + str(source_path))) mltrefhold.hold_ref(motion_producer) # Create sequence and add motion producer into it seq = sequence.Sequence(profile) seq.create_default_tracks() track = seq.tracks[seq.first_video_index] track.append(motion_producer, 0, motion_producer.get_length() - 1) print("motion clip render starting...") consumer = renderconsumer.get_render_consumer_for_encoding_and_quality( write_file, profile, encoding_option_index, quality_option_index) # start and end frames start_frame = 0 end_frame = motion_producer.get_length() - 1 wait_for_producer_stop = True if range_selection == 1: start_frame = int( float(media_file.length - media_file.mark_out - 1) * (1.0 / -speed)) end_frame = int( float(media_file.length - media_file.mark_out + (media_file.mark_out - media_file.mark_in) + 1) * (1.0 / -speed)) + int(1.0 / -speed) if end_frame > motion_producer.get_length() - 1: end_frame = motion_producer.get_length() - 1 if start_frame < 0: start_frame = 0 wait_for_producer_stop = False # consumer wont stop automatically and needs to stopped explicitly # Launch render global motion_renderer, motion_progress_update motion_renderer = renderconsumer.FileRenderPlayer( write_file, seq.tractor, consumer, start_frame, end_frame) motion_renderer.wait_for_producer_end_stop = wait_for_producer_stop motion_renderer.start() title = _("Rendering Reverse Clip") text = _("<b>Motion Clip File: </b>") + write_file progress_bar = Gtk.ProgressBar() dialog = rendergui.clip_render_progress_dialog( _FB_render_stop, title, text, progress_bar, gui.editor_window.window) motion_progress_update = renderconsumer.ProgressWindowThread( dialog, progress_bar, motion_renderer, _REVERSE_render_stop) motion_progress_update.start() else: dialog.destroy()
def _render_reverse_clip_dialog_callback(dialog, response_id, fb_widgets, media_file): if response_id == Gtk.ResponseType.ACCEPT: print("_render_reverse_clip_dialog_callback") # speed, filename folder speed = float(int(fb_widgets.hslider.get_value())) / 100.0 file_name = fb_widgets.file_name.get_text() filenames = fb_widgets.out_folder.get_filenames() folder = filenames[0] write_file = folder + "/" + file_name + fb_widgets.extension_label.get_text( ) if os.path.exists(write_file): primary_txt = _("A File with given path exists!") secondary_txt = _( "It is not allowed to render Motion Files with same paths as existing files.\nSelect another name for file." ) dialogutils.warning_message(primary_txt, secondary_txt, dialog) return # Profile profile_index = fb_widgets.out_profile_combo.get_active() if profile_index == 0: # project_profile is first selection in combo box profile = PROJECT().profile else: profile = mltprofiles.get_profile_for_index(profile_index - 1) profile_desc = profile.description().replace(" ", "_") # Render consumer properties encoding_option_index = fb_widgets.encodings_cb.get_active() quality_option_index = fb_widgets.quality_cb.get_active() # Range range_selection = fb_widgets.render_range.get_active() dialog.destroy() # Create motion producer source_path = media_file.path if media_file.is_proxy_file == True: source_path = media_file.second_file_path motion_producer = mlt.Producer( profile, None, str("timewarp:" + str(speed) + ":" + str(source_path))) # start and end frames start_frame = 0 end_frame = motion_producer.get_length() - 1 render_full_range = True if range_selection == 1: start_frame = int( float(media_file.length - media_file.mark_out - 1) * (1.0 / -speed)) end_frame = int( float(media_file.length - media_file.mark_out + (media_file.mark_out - media_file.mark_in) + 1) * (1.0 / -speed)) + int(1.0 / -speed) if end_frame > motion_producer.get_length() - 1: end_frame = motion_producer.get_length() - 1 if start_frame < 0: start_frame = 0 render_full_range = False # consumer wont stop automatically and needs to stopped explicitly session_id = hashlib.md5(str( os.urandom(32)).encode('utf-8')).hexdigest() args = ("session_id:" + str(session_id), "speed:" + str(speed), "write_file:" + str(write_file), "profile_desc:" + str(profile_desc), "encoding_option_index:" + str(encoding_option_index), "quality_option_index:" + str(quality_option_index), "source_path:" + str(source_path), "render_full_range:" + str(render_full_range), "start_frame:" + str(start_frame), "end_frame:" + str(end_frame)) job_queue_object = jobs.MotionRenderJobQueueObject( session_id, write_file, args) job_queue_object.add_to_queue() else: dialog.destroy()
def run(self): self.start_time = time.monotonic() self.render_player = None self.frames_range_writer = None self.script_renderer = None if self.render_data.save_internally == True: frame_name = "frame" else: frame_name = self.render_data.frame_name clip_frames_folder = ccrutils.clip_frames_folder() rendered_frames_folder = ccrutils.rendered_frames_folder() profile = mltprofiles.get_profile(self.profile_desc) # Delete old clip frames for frame_file in os.listdir(clip_frames_folder): file_path = os.path.join(clip_frames_folder, frame_file) os.remove(file_path) # Delete old rendered frames for frame_file in os.listdir(rendered_frames_folder): file_path = os.path.join(rendered_frames_folder, frame_file) os.remove(file_path) self.frames_range_writer = gmicplayer.FramesRangeWriter(self.clip_path, self.frames_update, profile) self.frames_range_writer.write_frames(clip_frames_folder + "/", frame_name, self.range_in, self.range_out) if self.abort == True: return script_file = open(self.script_path) user_script = script_file.read() while len(os.listdir(clip_frames_folder)) != self.length: time.sleep(0.5) # Render frames with gmic script self.script_renderer = gmicplayer.FolderFramesScriptRenderer( user_script, clip_frames_folder, rendered_frames_folder + "/", frame_name, self.script_render_update_callback, self.script_render_output_callback, 10, False, # this is not useful until we get MLT to find frames sequences not startin from 0001 0) self.script_renderer.write_frames() ccrutils.delete_clip_frames() if self.abort == True: return # Render video if self.render_data.do_video_render == True: # Render consumer args_vals_list = toolsencoding.get_args_vals_list_for_render_data(self.render_data) profile = mltprofiles.get_profile_for_index(self.render_data.profile_index) if self.render_data.save_internally == True: file_path = ccrutils.session_folder() + "/" + appconsts.CONTAINER_CLIP_VIDEO_CLIP_NAME + self.render_data.file_extension else: file_path = self.render_data.render_dir + "/" + self.render_data.file_name + self.render_data.file_extension consumer = renderconsumer.get_mlt_render_consumer(file_path, profile, args_vals_list) # Render producer frame_file = rendered_frames_folder + "/" + frame_name + "_0000.png" resource_name_str = utils.get_img_seq_resource_name(frame_file, True) resource_path = rendered_frames_folder + "/" + resource_name_str producer = mlt.Producer(profile, str(resource_path)) frames_length = len(os.listdir(rendered_frames_folder)) self.render_player = renderconsumer.FileRenderPlayer("", producer, consumer, 0, frames_length - 1) self.render_player.wait_for_producer_end_stop = False self.render_player.start() while self.render_player.stopped == False: self.abort_requested() if self.abort == True: self.render_player.shutdown() return fraction = self.render_player.get_render_fraction() self.video_render_update_callback(fraction) time.sleep(0.3) ccrutils.delete_rendered_frames() # Write out completed flag file. ccrutils.write_completed_message()
def _display_default_profile(): profile = mltprofiles.get_profile_for_index(default_profile_index) _fill_info_box(profile)
def _out_profile_changed(w): profile = mltprofiles.get_profile_for_index(w.get_active()) _fill_info_box(profile)
def main(root_path, session_id, project_path, range_in, range_out, profile_desc): try: editorstate.mlt_version = mlt.LIBMLT_VERSION except: editorstate.mlt_version = "0.0.99" # magic string for "not found" # Set paths. respaths.set_paths(root_path) userfolders.init() editorpersistance.load() # Init translations module with translations data translations.init_languages() translations.load_filters_translations() mlttransitions.init_module() repo = mlt.Factory().init() processutils.prepare_mlt_repo(repo) # Set numeric locale to use "." as radix, MLT initilizes this to OS locale and this causes bugs locale.setlocale(locale.LC_NUMERIC, 'C') # Check for codecs and formats on the system mltenv.check_available_features(repo) renderconsumer.load_render_profiles() # Load filter and compositor descriptions from xml files. mltfilters.load_filters_xml(mltenv.services) mlttransitions.load_compositors_xml(mltenv.transitions) # Create list of available mlt profiles mltprofiles.load_profile_list() ccrutils.init_session_folders(session_id) ccrutils.load_render_data() log_path = GLib.get_user_cache_dir() + "/blenderrenderlog" FLOG = open(log_path, 'w') render_setup_script = respaths.ROOT_PATH + "/tools/blenderrendersetup.py" blender_launch = "/usr/bin/blender -b " + project_path + " -P " + render_setup_script global _start_time _start_time = time.monotonic() render_data = ccrutils.get_render_data() # Delete old rendered frames for non-preview renders. if render_data.is_preview_render == False: rendered_frames_folder = ccrutils.rendered_frames_folder() for frame_file in os.listdir(rendered_frames_folder): file_path = os.path.join(rendered_frames_folder, frame_file) os.remove(file_path) else: # For preview render delete preview frames preview_frames_folder = ccrutils.preview_frames_folder() for frame_file in os.listdir(preview_frames_folder): file_path = os.path.join(preview_frames_folder, frame_file) os.remove(file_path) p = subprocess.Popen(blender_launch, shell=True, stdin=FLOG, stdout=FLOG, stderr=FLOG, preexec_fn=os.setsid) manager_thread = ProgressPollingThread(range_in, range_out, p, render_data.is_preview_render) manager_thread.start() p.wait() if manager_thread.abort == True: return # Render video if render_data.do_video_render == True: # Change file numbering to start from 0000 to please ffmpeg rendered_folder = ccrutils.rendered_frames_folder() + "/" files = [ f for f in listdir(rendered_folder) if isfile(join(rendered_folder,f)) ] files.sort(key=lambda var:[int(x) if x.isdigit() else x for x in re.findall(r'[^0-9]|[0-9]+', var)]) number = 0 for rendered_file in files: source_file = rendered_folder + rendered_file file_number = '{0:04d}'.format(number) dst_file = rendered_folder + "videoframe" + file_number + ".png" Path(source_file).rename(dst_file) number += 1 # Render consumer args_vals_list = toolsencoding.get_args_vals_list_for_render_data(render_data) profile = mltprofiles.get_profile_for_index(render_data.profile_index) if ccrutils.get_render_data().save_internally == True: file_path = ccrutils.session_folder() + "/" + appconsts.CONTAINER_CLIP_VIDEO_CLIP_NAME + render_data.file_extension else: file_path = render_data.render_dir + "/" + render_data.file_name + render_data.file_extension consumer = renderconsumer.get_mlt_render_consumer(file_path, profile, args_vals_list) # Render producer rendered_frames_folder = ccrutils.rendered_frames_folder() frames_info = gmicplayer.FolderFramesInfo(rendered_frames_folder) frame_file = frames_info.get_lowest_numbered_file() if editorstate.mlt_version_is_equal_or_greater("0.8.5"): resource_name_str = utils.get_img_seq_resource_name(frame_file, True) else: resource_name_str = utils.get_img_seq_resource_name(frame_file, False) resource_path = rendered_frames_folder + "/" + resource_name_str producer = mlt.Producer(profile, str(resource_path)) frames_length = len(os.listdir(rendered_frames_folder)) render_player = renderconsumer.FileRenderPlayer("", producer, consumer, 0, frames_length - 1) render_player.wait_for_producer_end_stop = False render_player.start() abort = False while render_player.stopped == False and abort == False: abort = ccrutils.abort_requested() if abort == True: render_player.shutdown() return else: fraction = render_player.get_render_fraction() elapsed = time.monotonic() - _start_time msg = "2 " + str(fraction) + " " + str(elapsed) ccrutils.write_status_message(msg) time.sleep(1.0) else: manager_thread.abort = True # to exit while loop and end thread ccrutils.write_completed_message()
def run(self): self.start_time = time.monotonic() args_vals_list = toolsencoding.get_args_vals_list_for_render_data( self.render_data) profile = mltprofiles.get_profile_for_index( self.render_data.profile_index) producer = mlt.Producer(profile, str(self.xml_file_path)) # Video clip consumer if self.render_data.do_video_render == True: if self.render_data.save_internally == True: file_path = ccrutils.session_folder( ) + "/" + appconsts.CONTAINER_CLIP_VIDEO_CLIP_NAME + self.render_data.file_extension else: file_path = self.render_data.render_dir + "/" + self.render_data.file_name + self.render_data.file_extension consumer = renderconsumer.get_mlt_render_consumer( file_path, profile, args_vals_list) ccrutils.delete_rendered_frames( ) # in case we switched from img seq consumer we can now delete those frames to save space # img seq consumer else: # Image sequence gets project profile project_profile = mltprofiles.get_profile(self.profile_desc) if self.render_data.save_internally == True: frame_name = "frame" else: frame_name = self.render_data.frame_name render_path = ccrutils.rendered_frames_folder( ) + frame_name + "_%04d." + "png" consumer = mlt.Consumer(project_profile, "avformat", str(render_path)) consumer.set("real_time", -1) consumer.set("rescale", "bicubic") consumer.set("vcodec", "png") self.render_player = renderconsumer.FileRenderPlayer( "", producer, consumer, self.range_in, self.range_out) self.render_player.wait_for_producer_end_stop = False self.render_player.start() while self.render_player.stopped == False: self.abort_requested() if self.abort == True: self.render_player.shutdown() return fraction = self.render_player.get_render_fraction() self.render_update_callback(fraction) time.sleep(0.3) # Write out completed flag file. ccrutils.write_completed_message()
def new_project(profile_index, v_tracks, a_tracks): sequence.VIDEO_TRACKS_COUNT = v_tracks sequence.AUDIO_TRACKS_COUNT = a_tracks profile = mltprofiles.get_profile_for_index(profile_index) new_project = projectdata.Project(profile) open_project(new_project)
def run(self): self.render_player = None self.frames_range_writer = None self.abort = False # Refuse to render into user home folder out_folder = _window.out_folder.get_filenames()[0] + "/" if out_folder == (os.path.expanduser("~") + "/"): print "home folder" return start_time = time.time() Gdk.threads_enter() _window.render_status_info.set_markup("") _window.set_widgets_sensitive(False) _window.render_percentage.set_sensitive(True) _window.render_status_info.set_sensitive(True) _window.render_progress_bar.set_sensitive(True) _window.stop_button.set_sensitive(True) _window.render_button.set_sensitive(False) _window.close_button.set_sensitive(False) _window.encode_settings_button.set_sensitive(False) _window.encode_desc.set_sensitive(False) _window.hamburger_launcher.widget.set_sensitive(False) _window.load_button.set_sensitive(False) Gdk.threads_leave() # Delete old preview frames folder = get_render_frames_dir() for frame_file in os.listdir(folder): file_path = os.path.join(folder, frame_file) os.remove(file_path) # Render clipm frames for range mark_in = _player.producer.mark_in mark_out = _player.producer.mark_out self.length = mark_out - mark_in + 1 self.mark_in = mark_in self.mark_out = mark_out frame_name = _window.frame_name.get_text() # jotain controllii frame_namelle self.frames_range_writer = gmicplayer.FramesRangeWriter(_current_path, self.frames_update) self.frames_range_writer.write_frames(get_render_frames_dir() + "/", frame_name, mark_in, mark_out) if self.abort == True: return # Render effect for frames # Get user script Gdk.threads_enter() buf = _window.script_view.get_buffer() user_script = buf.get_text(buf.get_start_iter(), buf.get_end_iter(), False) _window.render_percentage.set_markup("<small>" + _("Waiting for frames write to complete...") + "</small>") Gdk.threads_leave() while len(os.listdir(folder)) != self.length: time.sleep(0.5) clip_frames = os.listdir(folder) frame_count = 1 for clip_frame in clip_frames: if self.abort == True: return update_info = _("Rendering frame: ") + str(frame_count) + "/" + str(self.length) Gdk.threads_enter() _window.render_percentage.set_markup("<small>" + update_info + "</small>") _window.render_progress_bar.set_fraction(float(frame_count)/float(self.length)) Gdk.threads_leave() file_numbers_list = re.findall(r'\d+', clip_frame) filled_number_str = str(file_numbers_list[0]).zfill(3) clip_frame_path = os.path.join(folder, clip_frame) rendered_file_path = out_folder + frame_name + "_" + filled_number_str + ".png" script_str = "gmic " + clip_frame_path + " " + user_script + " -output " + rendered_file_path if frame_count == 1: # first frame displays shell output and does error checking FLOG = open(utils.get_hidden_user_dir_path() + "log_gmic_preview", 'w') p = subprocess.Popen(script_str, shell=True, stdin=FLOG, stdout=FLOG, stderr=FLOG) p.wait() FLOG.close() # read log f = open(utils.get_hidden_user_dir_path() + "log_gmic_preview", 'r') out = f.read() f.close() Gdk.threads_enter() _window.out_view.get_buffer().set_text(out + "Return code:" + str(p.returncode)) if p.returncode != 0: _window.out_view.override_color((Gtk.StateFlags.NORMAL and Gtk.StateFlags.ACTIVE), Gdk.RGBA(red=1.0, green=0.0, blue=0.0)) _window.render_percentage.set_text(_("Render error!")) Gdk.threads_leave() return else: _window.out_view.override_color((Gtk.StateFlags.NORMAL and Gtk.StateFlags.ACTIVE), None) Gdk.threads_leave() else: FLOG = open(utils.get_hidden_user_dir_path() + "log_gmic_preview", 'w') p = subprocess.Popen(script_str, shell=True, stdin=FLOG, stdout=FLOG, stderr=FLOG) p.wait() FLOG.close() frame_count = frame_count + 1 # Render video if _window.encode_check.get_active() == True: # Render consumer args_vals_list = toolsencoding.get_args_vals_list_for_render_data(_render_data) profile = mltprofiles.get_profile_for_index(_current_profile_index) file_path = _render_data.render_dir + "/" + _render_data.file_name + _render_data.file_extension consumer = renderconsumer.get_mlt_render_consumer(file_path, profile, args_vals_list) # Render producer frame_file = out_folder + frame_name + "_0000.png" if editorstate.mlt_version_is_equal_or_greater("0.8.5"): resource_name_str = utils.get_img_seq_resource_name(frame_file, True) else: resource_name_str = utils.get_img_seq_resource_name(frame_file, False) resource_path = out_folder + "/" + resource_name_str producer = mlt.Producer(profile, str(resource_path)) self.render_player = renderconsumer.FileRenderPlayer("", producer, consumer, 0, len(clip_frames) - 1) self.render_player.wait_for_producer_end_stop = False self.render_player.start() while self.render_player.stopped == False: if self.abort == True: return fraction = self.render_player.get_render_fraction() update_info = _("Rendering video, ") + str(int(fraction * 100)) + _("% done") Gdk.threads_enter() _window.render_percentage.set_markup("<small>" + update_info + "</small>") _window.render_progress_bar.set_fraction(fraction) Gdk.threads_leave() time.sleep(0.3) Gdk.threads_enter() _window.render_percentage.set_markup("<small>" + _("Render complete!") + "</small>") self.set_render_stopped_gui_state() Gdk.threads_leave()
def _load_values_clicked(widgets): load_profile_combo, description, f_rate_num, f_rate_dem, width, height, \ s_rate_num, s_rate_dem, d_rate_num, d_rate_dem, progressive = widgets profile = mltprofiles.get_profile_for_index(load_profile_combo.get_active()) _fill_new_profile_panel_widgets(profile, widgets)
def fill_options(self): default_profile = mltprofiles.get_profile_for_index(default_profile_index) self.categories_combo.set_selected(default_profile.description())