Exemplo n.º 1
0
    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 fin 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()
Exemplo n.º 2
0
    def run(self):      
        hidden_dir = utils.get_hidden_user_dir_path()

        try:
            data_file_path = hidden_dir + CURRENT_RENDER_RENDER_ITEM
            data_file = open(data_file_path)
            render_item = pickle.load(data_file)
            self.error_status = None
        except Exception as e:
            if self.error_status == None:
                self.error_status = []
            self.error_status = ("Current render datafile load failed with ") + str(e)
            # something 
            return 

        current_render_time = 0

        # Create render objects
        project_file_path = hidden_dir + CURRENT_RENDER_PROJECT_FILE
        persistance.show_messages = False

        project = persistance.load_project(project_file_path, False)

        producer = project.c_seq.tractor
        consumer = renderconsumer.get_mlt_render_consumer(render_item.render_path, 
                                                          project.profile,
                                                          render_item.args_vals_list)

        # Get render range
        start_frame, end_frame, wait_for_stop_render = get_render_range(render_item)
        
        # Create and launch render thread
        render_thread = renderconsumer.FileRenderPlayer(None, producer, consumer, start_frame, end_frame) # None == file name not needed this time when using FileRenderPlayer because callsite keeps track of things
        render_thread.wait_for_producer_end_stop = wait_for_stop_render
        render_thread.start()

        # Set render start time and item state
        render_item.render_started()

        Gdk.threads_enter()
        #single_render_window.update_queue_view()
        single_render_window.current_render.set_text("  " + os.path.basename(render_item.render_path))
        Gdk.threads_leave()

        # Make sure that render thread is actually running before
        # testing render_thread.running value later
        while render_thread.has_started_running == False:
            time.sleep(0.05)

        # View update loop
        self.running = True

        while self.running:
            render_fraction = render_thread.get_render_fraction()
            now = time.time()
            current_render_time = now - render_item.start_time
            
            Gdk.threads_enter()
            single_render_window.update_render_progress(render_fraction, render_item.get_display_name(), current_render_time)
            Gdk.threads_leave()
            
            if render_thread.running == False: # Rendering has reached end
                self.running = False
                
                Gdk.threads_enter()
                single_render_window.render_progress_bar.set_fraction(1.0)
                Gdk.threads_leave()

            time.sleep(0.33)
                
        render_thread.shutdown()
        global single_render_thread
        single_render_thread = None
        # Update view for render end
        GLib.idle_add(_single_render_shutdown)
Exemplo n.º 3
0
    def run(self):        
        self.running = True
        items = 0
        global render_queue, batch_window
        for render_item in render_queue.queue:
            if self.running == False:
                break
            if render_item.render_this_item == False:
                continue
            
            current_render_time = 0

            # Create render objects
            identifier = render_item.generate_identifier()
            project_file_path = get_projects_dir() + identifier + ".flb"
            persistance.show_messages = False

            project = persistance.load_project(project_file_path, False)

            producer = project.c_seq.tractor
            consumer = renderconsumer.get_mlt_render_consumer(render_item.render_path, 
                                                              project.profile,
                                                              render_item.args_vals_list)

            # Get render range
            start_frame, end_frame, wait_for_stop_render = get_render_range(render_item)
            
            # Create and launch render thread
            global render_thread 
            render_thread = renderconsumer.FileRenderPlayer(None, producer, consumer, start_frame, end_frame) # None == file name not needed this time when using FileRenderPlayer because callsite keeps track of things
            render_thread.wait_for_producer_end_stop = wait_for_stop_render
            render_thread.start()

            # Set render start time and item state
            render_item.render_started()

            Gdk.threads_enter()
            batch_window.update_queue_view()
            batch_window.current_render.set_text("  " + render_item.get_display_name())
            Gdk.threads_leave()

            # Make sure that render thread is actually running before
            # testing render_thread.running value later
            while render_thread.has_started_running == False:
                time.sleep(0.05)

            # View update loop
            self.thread_running = True
            self.aborted = False
            while self.thread_running:
                if self.aborted == True:
                    break        
                render_fraction = render_thread.get_render_fraction()
                now = time.time()
                current_render_time = now - render_item.start_time
                
                Gdk.threads_enter()
                batch_window.update_render_progress(render_fraction, items, render_item.get_display_name(), current_render_time)
                Gdk.threads_leave()
                
                if render_thread.running == False: # Rendering has reached end
                    self.thread_running = False
                    
                    Gdk.threads_enter()
                    batch_window.render_progress_bar.set_fraction(1.0)
                    Gdk.threads_leave()
                                    
                    render_item.render_completed()
                else:
                    time.sleep(0.33)
                    
            if not self.aborted:
                items = items + 1
                Gdk.threads_enter()
                batch_window.update_render_progress(0, items, render_item.get_display_name(), 0)
                Gdk.threads_leave()
            else:
                if render_item != None:
                    render_item.render_aborted()
                    break
            render_thread.shutdown()
        
        # Update view for render end
        Gdk.threads_enter()
        batch_window.reload_queue() # item may havee added to queue while rendering
        batch_window.render_queue_stopped()
        Gdk.threads_leave()
Exemplo n.º 4
0
    def run(self):
        self.start_time = time.monotonic()

        if self.render_data.save_internally == True:
            frame_name = "frame"
        else:
            frame_name = self.render_data.frame_name

        rendered_frames_folder = ccrutils.rendered_frames_folder()

        # 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)

        if self.abort == True:
            return

        script_file = open(self.script_path)
        user_script = script_file.read()

        profile_file_path = mltprofiles.get_profile_file_path(
            self.profile_desc)

        editors_data_json = json.dumps(
            self.fluxity_plugin_edit_data["editors_list"]
        )  # See fluxity.FluxityContext.get_script_data()

        fluxity.render_frame_sequence(user_script, self.range_in,
                                      self.range_out, rendered_frames_folder,
                                      profile_file_path, self.frames_update,
                                      editors_data_json, True)

        render_length = self.range_out - self.range_in
        while len(os.listdir(rendered_frames_folder)) != render_length:
            if self.abort == True:
                return
            time.sleep(0.5)

        # 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
            num_part = str(1).zfill(5)

            frame_file = rendered_frames_folder + "/" + frame_name + "_" + num_part + ".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()
Exemplo n.º 5
0
def main(root_path, session_id, project_path, range_in, range_out,
         profile_desc):

    project_path = utils.escape_shell_path(project_path)

    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 " + utils.escape_shell_path(
        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()

    print("Blender render complete.")
Exemplo n.º 6
0
    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()
Exemplo n.º 7
0
    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()
Exemplo n.º 8
0
    def run(self):
        self.running = True
        items = 0
        global render_queue, batch_window
        for render_item in render_queue.queue:
            if self.running == False:
                break
            if render_item.render_this_item == False:
                continue

            current_render_time = 0

            # Create render objects
            identifier = render_item.generate_identifier()
            project_file_path = get_projects_dir() + identifier + ".flb"
            persistance.show_messages = False

            project = persistance.load_project(project_file_path, False)

            producer = project.c_seq.tractor
            consumer = renderconsumer.get_mlt_render_consumer(
                render_item.render_path, project.profile,
                render_item.args_vals_list)

            # Get render range
            start_frame, end_frame, wait_for_stop_render = get_render_range(
                render_item)

            # Create and launch render thread
            global render_thread
            render_thread = renderconsumer.FileRenderPlayer(
                None, producer, consumer, start_frame, end_frame
            )  # None == file name not needed this time when using FileRenderPlayer because callsite keeps track of things
            render_thread.wait_for_producer_end_stop = wait_for_stop_render
            render_thread.start()

            # Set render start time and item state
            render_item.render_started()

            gtk.gdk.threads_enter()
            batch_window.update_queue_view()
            batch_window.current_render.set_text(
                "  " + render_item.get_display_name())
            gtk.gdk.threads_leave()

            # Make sure that render thread is actually running before
            # testing render_thread.running value later
            while render_thread.has_started_running == False:
                time.sleep(0.05)

            # View update loop
            self.thread_running = True
            self.aborted = False
            while self.thread_running:
                if self.aborted == True:
                    break
                render_fraction = render_thread.get_render_fraction()
                now = time.time()
                current_render_time = now - render_item.start_time

                gtk.gdk.threads_enter()
                batch_window.update_render_progress(
                    render_fraction, items, render_item.get_display_name(),
                    current_render_time)
                gtk.gdk.threads_leave()

                if render_thread.running == False:  # Rendering has reached end
                    self.thread_running = False

                    gtk.gdk.threads_enter()
                    batch_window.render_progress_bar.set_fraction(1.0)
                    gtk.gdk.threads_leave()

                    render_item.render_completed()
                else:
                    time.sleep(0.33)

            if not self.aborted:
                items = items + 1
                gtk.gdk.threads_enter()
                batch_window.update_render_progress(
                    0, items, render_item.get_display_name(), 0)
                gtk.gdk.threads_leave()
            else:
                if render_item != None:
                    render_item.render_aborted()
                    break
            render_thread.shutdown()

        # Update view for render end
        gtk.gdk.threads_enter()
        batch_window.reload_queue(
        )  # item may havee added to queue while rendering
        batch_window.render_queue_stopped()
        gtk.gdk.threads_leave()