View Full Version : Vapoursynth Looping
jay123210599
25th January 2026, 04:34
How do I loop certain frames in a video using Vapoursynth?
_Al_
27th January 2026, 10:56
that will replace frames
https://www.vapoursynth.com/doc/functions/video/freezeframes.html#freezeframes
jay123210599
28th January 2026, 01:02
that will replace frames
https://www.vapoursynth.com/doc/functions/video/freezeframes.html#freezeframes
Okay, say I have a video. I want to start from the beginning and then loop frames 405-533 5 times. How do I do that?
Z2697
28th January 2026, 02:50
[:405]+[405:534]*5(6?)+[534:]
jay123210599
28th January 2026, 15:31
[:405]+[405:534]*5(6?)+[534:]
Put that in a full script with a video file included.
StainlessS
28th January 2026, 15:37
Put that in a full script with a video file included.
Since you're gonna ask how to mod for your script, why not provide YOUR script and maybe Z2697 can alter/insert to suit your script.
jay123210599
28th January 2026, 16:25
Since you're gonna ask how to mod for your script, why not provide YOUR script and maybe Z2697 can alter/insert to suit your script.
Here's my script:
from vapoursynth import core
clip = core.ffms2.Source(r"video.mp4")
clip = core.std.FreezeFrames(clip, [:405]+[405:534]*5(6?)+[534:])
clip.set_output()
Columbo
28th January 2026, 18:41
Could be wrong but I don't think you need the (6?). Maybe he was just indicating that the 5 should possibly be a 6 instead.
Z2697
28th January 2026, 21:01
I mean it's a syntactic sugar of VapourSynth/Python.
clip = clip[:405] + clip[405:534]*5 + clip[534:]
5(6?) means the "loop for 5 times" description is ambigous (to me)
jay123210599
28th January 2026, 21:33
I mean it's a syntactic sugar of VapourSynth/Python.
clip = clip[:405] + clip[405:534]*5 + clip[534:]
5(6?) means the "loop for 5 times" description is ambigous (to me)
I got this:
vapoursynth.Error: Trim: invalid last frame specified (last is less than first)
_Al_
28th January 2026, 21:45
you do not have enough frames in your clip
Adub
28th January 2026, 21:57
You should updating Z2697's example with your own frame numbers.
That's what those numbers are in the brackets, they are frame numbers.
clip[:405] means all the frames up to frame 405
clip[405:534] means all of the frames between frames 405 and 534.
clip[534:] means frames starting from 534 and onwards.
The "* 5" means create 5 copies of the trimmed clip. The "+"s in the expression indicate to concatenate (add) together everything into a new contiguous clip.
Which frames you want to loop are dependent on your source.
This is explained in the documentation: https://www.vapoursynth.com/doc/pythonreference.html#slicing-and-other-syntactic-sugar
jay123210599
29th January 2026, 00:04
You should updating Z2697's example with your own frame numbers.
That's what those numbers are in the brackets, they are frame numbers.
clip[:405] means all the frames up to frame 405
clip[405:534] means all of the frames between frames 405 and 534.
clip[534:] means frames starting from 534 and onwards.
The "* 5" means create 5 copies of the trimmed clip. The "+"s in the expression indicate to concatenate (add) together everything into a new contiguous clip.
Which frames you want to loop are dependent on your source.
This is explained in the documentation: https://www.vapoursynth.com/doc/pythonreference.html#slicing-and-other-syntactic-sugar
All right, I fixed it. Now how do I make my video loop for a total of 24 hours?
Z2697
29th January 2026, 01:44
Are we ChatGPT?
_Al_
29th January 2026, 10:23
All right, I fixed it. Now how do I make my video loop for a total of 24 hours?
Use mpv player and such to repeat your videos
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.