Im trying to get this tracking script for running in the background working. It was working perfectly in the background until I got to the filter tracks portion. Here is the script:

import bpy

for area in bpy.context.screen.areas:
    if area.type == 'CLIP_EDITOR':
        override = bpy.context.copy()
        override['area'] = area
        bpy.ops.clip.detect_features(override, threshold = 0.05, min_distance = 25)
        print('Markers Detected')
        bpy.ops.clip.track_markers(override, sequence=True)
        print('Tracked Forward')
        bpy.ops.clip.track_markers(override, sequence=True, backwards=True)
        print('Tracked Backwards')
        totalFrames = bpy.context.scene.frame_end = bpy.context.scene.frame_start
        bpy.ops.clip.clean_tracks(override, frames=(totalFrames + 1), error=0.5, action='DELETE_TRACK')
        #Can get to here fine, error occurs when doing this filter track function
        bpy.ops.clip.filter_tracks(override['area'], track_threshold=5)
        bpy.ops.wm.save_as_mainfile(filepath="/Applications/blender2.76" + "test.blend")

Does anyone know how I could fix this?

enter image description here

This is currently what the errors are looking like now for this.


1 Answer 1



bpy.ops.clip.filter_tracks(override['area'], track_threshold=5)



And see if that works.

I'm not that familiar with what you are doing, however the reason I believe that you need to take out the extra argument is because of inspecting the auto-complete of the function when I enter it in directly at the console (it just seems like there is a problem with passing more than the threshold value - See Below):

enter image description here

After looking into this a little further, try just commenting this line out.

From the Manual it is meant to smooth out spikes in the track, the problem with this (this context) is: you just deleted the "spike" in your previous line of code, so there is no track to even deal with.


Maybe you just need to check and see if the previous statement deleted the track. Then set a variable to indicate if the track was deleted, then you can make a decision to filter it or not based on that.

  • 1
    $\begingroup$ I think the override still belongs to match what was used in previous ops. But it should be override not override['area']. $\endgroup$
    – sambler
    Mar 8, 2016 at 9:58
  • $\begingroup$ Just made an edit to the post to show the errors I get from terminal. I appreciate your guys help, will keep working at this but if you have any more ideas that would be greatly appreciated. $\endgroup$
    – CSSmitty
    Mar 9, 2016 at 6:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .