Blender VSE scripting with the Blender API and Python to automate things

Hi every one,

I’m not a 3d artist, i’m a software developer, a husband and a dad. I’ve created a youtube channel to provide free educational content for my kids and all children of the world.

My latest serie of educational resources about Coloring Pages for Kids, with this one as an example: https://youtu.be/UHTRP29TCHQ take about 1hour for video editing, then 10 minutes rendering.

I’m looking for a solution to automate things through scripting via python and the blender API to:

1- Select strips by name (No mouse clicks allowed)
2- Duplicate and Move a Strip
3- Move a Strip

That is all I need.

Thank you very much

I really need at least the 3 of the scripts above, to automate my vids.

number 1 should be doable somewhat like this


import bpy

targetName = 'blah'

for a in bpy.context.scene.sequence_editor.sequences_all:
    if targetName in a.name:
        a.select = True
    else:
        a.select = False

Thank you very much for your help. I’ve tested your code to select a strip and move it in the timeline. And it has worked.
Here is the code:

import bpy
bpy.context.area.type = ‘SEQUENCE_EDITOR’
targetName = ‘logo-md.png’
for a in bpy.context.scene.sequence_editor.sequences_all:
if targetName in a.name:
a.select = True
else:
a.select = False
bpy.ops.transform.seq_slide(value=(60, 0))

Thannk once again, i’ll test it with the duplicate functionality

Just a thing about blender python… the bpy.ops commands are usually slower then manipulating it directly… if you want to move it with that code, i would suggest


import bpy 
targetName = 'logo-md.png' 


offset = 60


for a in bpy.context.scene.sequence_editor.sequences_all:
    if targetName in a.name:
        a.frame_start += offset #this is setting the start frame to be start frame + 60, or start frame + offset

One other thing is if you are quoting code, encapsulate it with the [ code] [ /code] functions and it will indent correctly

Interesting
Can someone tell how to learn python methods to randomize vertex locations ?