Timelapse with sustained light streaks

I made this script to create this effect: http://vimeo.com/24048325

  1. Do a timelapse shoot in the night at a street
  2. Subtract an unluminated picture of the street from the rest of the pictures (can be done in VSE)
  3. Use this script to create the right setup in the VSE for the sustaining light streaks.
import bpy, os

dir="/path/"  # files must be in the form ####.png 
picture_start = 1   # index number of the first image
picture_end = 76    # index number of the last image
distance = 7       # distance of frames between two pictures
glowing_frames = 38 # number of frames a certain picture fades out
exponent = 1.5      # exponent for opacity (1 = linear decrease)


# get important variables
editor=bpy.data.scenes[0].sequence_editor
seq=editor.sequences
decr = 1 / glowing_frames


for opac in range(0,glowing_frames):
    f = 1
    for i in range(picture_start,picture_end):
        frame=[{"name":format(i, '04d') + ".png"}]
        bpy.ops.sequencer.image_strip_add( \
                directory = dir, \
                files = frame, \
                frame_start=f+opac, \
                frame_end=f+opac, \
                channel=opac+2, \
                filemode=9)
        f += distance
        if (opac > 0):
            seq=editor.sequences
            strip = seq[format(i, '04d') + "." + format(opac, '03d')]
            strip.blend_type = 'ADD'
            strip.blend_alpha = (1.0 - decr * opac)**exponent
        else:
            strip = seq[format(i, '04d') + ".png"]
            strip.blend_type = 'ADD'


I get an error using Blender 2.5.7 r36708.

None type has no property sequences

On line #13.

seq=editor.sequences

have you opened the VSE? I don’t know, why this happens? maybe the editor needs to be initialized (by opening it) before you run the script?

Looks a bit odd fading the streaks in and out (I think that your timelapse interval is a bit long and the cars move to far between), but this would be nice for Blenders Strip stretch. At the moment it just duplicates frames or drops them, a frame blend like this would be a big improvement.

Can I suggest trying a time stretch effect next?

what do you mean with a time stretch effect? would you like to increase the speed of the film?

To slow film down blender 2.5 just duplicates frames to stretch to the right duration. Without optical flow technology, which fills in frames based on motion, smoothing the in between frames with blending or dissolves would be better. It is the old way of adding motion blur before nodes added vector blur.

well, the technique I chose allows me to work with an exponent to fine tune the fade out effect. moreover, I just wanted to separate the background from the ligths, thats why I included the preprocessing step. I don’t think, that i would achieve the same with the blend-effects you described.

Oh I see, did you use the waveform to fcurve tool to get the right pulsing with the beat?

no, the pulse is not synchronized with the beat. a new frame appears just every 7 sec.
Yes, an effect with this kind of fade out effect (which just increases the alpha) would be very nice.