8
$\begingroup$

Is it possible to automate the sequencer so that each time I render an animation into image files in a folder, the newly rendered image files would be inputted into the sequencer in a specific arrangement or something like this?:

  1. Load images 1-300 and place in sequencer
  2. Load images 1-300, again, and place after first image sequence
  3. Apply backwards effect to the second image sequence

If not an option in blender, is there a way to create a script to do this? Often I will rerender the same animation with a different setting or something, but every time I have to manually apply what was described above. I'm not necessarily asking for a solution specified to this example, but for all examples like this. Is there something that would work to automate this process?

Any help is appreciated. If what I am describing is unclear I can further describe it.

$\endgroup$
11
$\begingroup$

Yes, blenders sequencer has full Python API access so it can be used to do quite advanced video editing both from the UI or in background mode (headless).

import os

from bpy import context
scene = context.scene

path = "/my_path/to/images"
files = os.listdir(path)
files.sort()

# create the sequencer data
scene.sequence_editor_create()

seq = scene.sequence_editor.sequences.new_image(
        name="MyStrip",
        filepath=os.path.join(path, files[0]),
        channel=1, frame_start=1)

# add the rest of the images.
for f in files[1:300]:
    seq.elements.append(f)

# reverse if you want
seq.use_reverse_frames = False

The rest I'm sure you can work out.

$\endgroup$
3
$\begingroup$

Yes, It is quite possible (ideasman42 already gave an example of the Sequencer API usage).

You can also setup the automation logic that will create/update your sequencer using a render complete handler. In your addon, You can register the sequencer setup handler to run after render completes.

@bpy.app.handlers.persistent
def process_in_sequencer(self, context):
    <logic goes here>

bpy.app.handlers.render_complete.append(process_in_sequencer)
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.