Sequencer Python API - can't do movie strips

Scripting in Blender with Python, and working on the API

Moderators: jesterKing, stiv

Post Reply
Posts: 0
Joined: Tue Jul 01, 2008 3:28 am

Sequencer Python API - can't do movie strips

Post by spamagnet »

I was working on a Python script today and attempting to add a MOVIE strip to the sequence. Here is my (simplified) script:

Code: Select all

from Blender import *

def main():
    scn = Scene.GetCurrent()
    seq = scn.sequence
    # COLOR strip -- works!
    start = 50
    track = 2
    seq_data = ( 0.5, 0.0, 0.0 )
    strip = seq_data, start, track)

    # MOVIE strip ...
    start = 50
    track = 3
    seq_data = "s:/test.avs"
    strip = seq_data, start, track)

The COLOR strip works fine, but the MOVIE strip inserts a weird bogus strip that crashes Blender as soon as you try to do anything with it. I looked through the Python sequencer API source code and it looks like the section that deals with movies is simply not coded. My guess is that this part of the API has been used mostly for image sequences.

Anyway, my questions are:
  • Am I correct that this has not yet been implemented?
  • Where can I go to see if there are any existing change requests for this? (
  • If I am interested in coding it, who should I talk to about making sure I get it right?
Thanks! (And thanks again to all you coders for your work on Blender!)

Posts: 71
Joined: Mon Oct 21, 2002 12:53 am
Location: Bucks, England

Post by LethalSideParting »

Hi there,
I've been struggling with the same problem myself. A lucky search in the source code put me on the right track, and I finally found that you need to pass arguments differently for image sequences compared with audio/movie files. This seems to be the correct way to import stuff into the sequencer:

Code: Select all

import Blender
from Blender import *

def main():
    sce = Scene.GetCurrent()
    seq = sce.sequence
    if not seq:
        print 'This scene has no sequence data yet'
    start = 10
    track = 1
    # For importing an AVI
    seq_data = ( "example.avi", "/path/to/avi/", "/path/to/avi/example.avi", "movie" )

    #Alternatively, comment the above and use this for an image sequence
    #seq_data = ( "/path/to/images/", ("001.jpg", "002.jpg", "003.jpg") )

    #Or, use this for audio:
    seq_data = ( "example.wav", "/path/to/audio/", "/path/to/audio/example.wav", "audio_hd" )

    strip =, start, track)
    #Wow. From here, we can access all of the following in the strip object:
    #'blendMode', 'channel', 'copy', 'endOffset', 'endStill', 'filtery', 'flipX', 'flipY', 'floatBuffer', 'images', 'ipo',
    #'ipoLocked', 'length', 'lock', 'mute', 'name', 'new', 'next', 'premul', 'proxyDir', 'rebuildProxy', 'remove', 'reversed',
    #'scene', 'sel', 'selLeft', 'selRight', 'sound', 'start', 'startOffset', 'startStill', 'type', 'useProxy'
Hope this helps! :)


Post Reply