1
$\begingroup$

How can I repeat a video strip without duplicate it manually in a long frame range in VSE?

One image sequence has 40 frames, I want it repeated play in range [0,5000], One method is duplicate the stripe in VSE manually that's a hard and boring work, Is there any setting like property[play repeatedly].

Otherwise, how to do this job with script.

Simply copy the script in Script console panel is wrong.

$\endgroup$
3
  • $\begingroup$ hi, can I ask what you mean by the last sentence? $\endgroup$
    – pevinkinel
    Commented Feb 14, 2023 at 12:04
  • $\begingroup$ @pevinkinel. most manipulations by hand will generate some script in the Script Window, but some of them are not low-level. $\endgroup$ Commented Feb 14, 2023 at 12:05
  • $\begingroup$ ah, right! thanks $\endgroup$
    – pevinkinel
    Commented Feb 14, 2023 at 12:06

1 Answer 1

0
$\begingroup$

I came up with this, which might be a bit buggy but it fills the remaining space of the timeline with copies of the currently selected strip (the text editor and VSE must be visible for it to work).

import bpy
from bpy import context

for area in context.screen.areas:
    if area.ui_type == 'SEQUENCE_EDITOR':
        override = context.copy()
        override['area'] = area
        break

scene = context.scene
strip = context.scene.sequence_editor.active_strip
scene_length = scene.frame_end - strip.frame_final_start
strip_length = strip.frame_final_duration
count = int( scene_length / strip_length ) 

for i in range(count):
    bpy.ops.sequencer.duplicate_move(override, 
    TRANSFORM_OT_seq_slide={"value":(strip_length, 0)})

The first half of the code is just to convince blender to look at the sequence editor.
The second half calculates how much space is left between the selected strip and the end frame, and how many copies it would take to fill that space, then repeatedly copies and slides the strip.

Note: this type of area override is being deprecated so it will stop working at some point (I couldn't get the new type to work).

$\endgroup$

You must log in to answer this question.

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