<p>While having some fun in Python programming language I found a library that allows users to write custom code to overlay (possibly) infinite amount of clips.</p>

<p><strong><a href="https://zulko.github.io/moviepy/getting_started/compositing.html" rel="nofollow noreferrer">MoviePy</a></strong></p>

<p><a href="https://i.sstatic.net/lYpU4.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/lYpU4.png" alt="enter image description here"></a></p>

<p><strong>Hope this helps!</strong></p>

CC BY-SA 4.0
2019-03-22T13:44:27.007Z
2019-03-22T13:44:27.007Z
Kaszanas
<p>I have a few hundred few-second-long video clips (c001.mp4-c999.mp4)
and need to merge them into a clip slideshow.  This is very easy - I drop them into iMovie and click "slideshow", done! </p>

<p><strong>However</strong> - I want to fit more clips in less time.  So I was hoping to show 2 clips at once, and stack vertical-video clips side-by-side.</p>

<p>Ideal would be some way to take a script of start times and upper-left positions, and render it to a combined flattened video?  (assuming basics like "no resizing" and "later clips are stacked on top of earlier clips if the earlier clip hasn't finished playing yet")</p>

<pre><code>file:c001.mp4, t:0:05:15, x:500, y:0 
file:c002.mp4, t:0:09:25, x:0, y:0
file:c003.mp4, t:0:12:00, x:500, y:0
etc. 
</code></pre>

CC BY-SA 4.0
2019-03-21T18:15:56.870Z
Do they all have the same duration?
llogan
CC BY-SA 4.0
2019-03-21T20:14:02.437Z
I could make them have the same duration!  They don't, but ideally, each clip would play to completion, and if another script line tried to play a clip over it, it would cover it.  So it would be my responsibility when building the script to avoid that.
Benjamin H
CC BY-SA 4.0
2019-03-21T21:13:40.337Z
One method is to use concat filters to make a left side and a right side, then stack with hstack filter. Easy to do, but that doesn't address duration differences so each set may not be synced (not sure if that is an issue for you). Another option is to use sendcmd with overlay. More complicated but you can have more control over timings, but you would have to create a command file (almost similar to your example). Do you have a preference?
llogan
<ffmpeg><script>
A program or script to overlay several video clips
Benjamin H
# A program or script to overlay several video clips

(Asked by: username_0 on 2019-03-21)

I have a few hundred few-second-long video clips (c001.mp4-c999.mp4)
and need to merge them into a clip slideshow.  This is very easy - I drop them into iMovie and click "slideshow", done! 
However - I want to fit more clips in less time.  So I was hoping to show 2 clips at once, and stack vertical-video clips side-by-side.
Ideal would be some way to take a script of start times and upper-left positions, and render it to a combined flattened video?  (assuming basics like "no resizing" and "later clips are stacked on top of earlier clips if the earlier clip hasn't finished playing yet")
file:c001.mp4, t:0:05:15, x:500, y:0 
file:c002.mp4, t:0:09:25, x:0, y:0
file:c003.mp4, t:0:12:00, x:500, y:0
etc.

**Tags:** ffmpeg, script

> **Comments:**
> **username_1**: Do they all have the same duration?  
> **username_0**: I could make them have the same duration!  They don't, but ideally, each clip would play to completion, and if another script line tried to play a clip over it, it would cover it.  So it would be my responsibility when building the script to avoid that.  
> **username_1**: One method is to use concat filters to make a left side and a right side, then stack with hstack filter. Easy to do, but that doesn't address duration differences so each set may not be synced (not sure if that is an issue for you). Another option is to use sendcmd with overlay. More complicated but you can have more control over timings, but you would have to create a command file (almost similar to your example). Do you have a preference?  

---

## 1 answers

### Answer by username_2 on 2019-03-22. Score: 2 | Accepted answer

While having some fun in Python programming language I found a library that allows users to write custom code to overlay (possibly) infinite amount of clips.

**[MoviePy](https://zulko.github.io/moviepy/getting_started/compositing.html)**

[![enter image description here](https://i.sstatic.net/lYpU4.png)](https://i.sstatic.net/lYpU4.png)

**Hope this helps!**


---

