Sequencer Python API - can't do movie strips

Scripting in Blender with Python, and working on the API

Moderators: jesterKing, stiv

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

Sequencer Python API - can't do movie strips

Post by spamagnet » Tue Aug 26, 2008 7:48 pm

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.new( seq_data, start, track)

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

main()
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? (http://projects.blender.org/?)
  • 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!)

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

Post by LethalSideParting » Sun Oct 05, 2008 3:41 am

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'
        return
    
    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 = seq.new(seq_data, 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'
main()
Hope this helps! :)

Karl

Post Reply