How to get a repeating, progressing forward backward sequence of a video file? My goal is to edit a video automatically, so that there are small parts reapeating in forward and backward motion with variable part lengths.
The sequence of frames for part length 1 would be: 1 2 3 2 3 4 3 4 5
Part length 2: 1 2 3 2 1 2 3 4 3 2 3 4 5
A friend provided me with an array, which can generate this and other sequences.

#!/usr/bin/python
# coding: utf8
amplitude = 5 #Min 1  
end = 30 
drunkenArr = []
i = 0
while i &lt;= end - amplitude + 1:
    for j in range(amplitude):
        drunkenArr.append(i + j)
    for j in range(amplitude)[::-1][1:-2]:
        drunkenArr.append(i + j)
    i = i + 1
print drunkenArr


There could be multiple ways:
- Opening a video file on consecutive frames and setting frame start to this sequence. This one will be very slow I think.
- Opening one video file and cut and copy the frames after a pattern
- converting the video file to single images and putting them into a folder ( could be done by hand, but with a script it would be much more convenient) and importing them in the sequence of an array.
Perhaps try this:

import os

from bpy import context
scene = context.scene

path = "C:/Users/Admin/Documents/Projects/VIDEO/atabilized/timelapse"
files = os.listdir(path)
files.sort()

# create the sequencer data
scene.sequence_editor_create()

seq = scene.sequence_editor.sequences.new_image(
    name="MyStrip",
    filepath=os.path.join(path, files[0]),
    channel=1, frame_start=1)

# add the images. forward and backwards
amplitude = 25
i=0
while i &lt;= files.len() - amplitude:
    for f in files[i : i + amplitude]: #forward
        seq.elements.append(f)
    for f in files[i + 2 : i + amplitude - 1 ][::-1] #backwards
        seq.elements.append(f)
    i += 1