Script to auto-detect features to track using Python I am attempting to make these GUI steps into a script. When I follow this process manually, I get a tracking error under 1 and I get some great matches. This is far better than autotrack.
import bpy

Step 1 - Set tracking settings extra correlation to .99:
bpy.data.movieclips[&quot;Name.png&quot;].(null) = 0.99

Step 2 - Loop through 1000 times
When in loop, it loops but only tracks one frame forward:
for loopv in range (1000):

Step 3 - Detect Features
bpy.ops.clip.detect_features(ctx)

Step 4 - Track Features 1 Frame
bpy.ops.clip.track_markers(ctx,backwards=False, sequence=False)

Step 5 - Deselect all features
bpy.ops.clip.select_all(ctx,action='TOGGLE')

or
bpy.ops.object.select_all(ctx,action='DESELECT')

Step 6 - End Indentation of loop and Return to Step 2
This is my current code. I have to hit Run Script. over and over, for it to work and go through all the frames of the clip.
import bpy
import random

#for loopv in range (1000):
ctx = bpy.context.copy()
for area in bpy.context.screen.areas:
   if area.type == 'CLIP_EDITOR':
   ctx['area'] = area

bpy.ops.clip.select_all(ctx,action='DESELECT')
bpy.ops.clip.detect_features(ctx)
bpy.ops.clip.track_markers(ctx,backwards=False, sequence=False)
You have to update the frame with the right command:
⚠ Note that none of these will properly do it for the tracker operators:
bpy.context.scene.frame_current = frameNumber
bpy.context.scene.frame_set(frameNumber)
bpy.ops.clip.change_frame (ctx, frame = frameNumber)

The one you have to use is:
area.spaces[0].clip_user.frame_current = frameNumber

Then you can un-comment and set up your for loop.
The area here is just bpy.context.screen.areas[number] or bpy.context.area but area alone works in the OP's script.
Or use this add-on I just made:
Step Tracker allows you to batch-track multiple &quot;steps&quot; of n frames without degrading performance on very long shots. Please read the Readme for instructions.