Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Small improvment of anonymous / gist:5663418 blender
import bpy
import csv
D =
frameNums = True # include frame numbers in the csv file
relativeCoords = False # marker coords will be relative to the dimensions of the clip
filepath = "/tmp/"
markers = {}
for clip in D.movieclips:
print('Clip {} found'.format(
if relativeCoords:
width = 1
height = 1
width = clip.size[0]
height = clip.size[1]
for ob in clip.tracking.objects:
print('Object {} found'.format(
for track in ob.tracks:
fn = '{}_{}_tr_{}'.format('.')[0],,
markers[fn] = []
print('track {} found'.format(
for framenum in range(clip.frame_duration):
markerAtFrame = track.markers.find_frame(framenum)
if markerAtFrame:
coords = list(
coords = [coords[0] * width, coords[1] * height]
for key, value in markers.items():
filename = "{}{}{}".format(filepath, key, ".csv")
open_data = open(filename, 'w', newline='')
with open_data as writer:
writer = csv.writer(writer, delimiter=';', quotechar='"', quoting=csv.QUOTE_NONNUMERIC)
if frameNums:
writer.writerow([key, "x", "y"])
for i, data in enumerate(value):
writer.writerow([i] + data)
writer.writerow(["x", "y"])
for data in value:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment