<p>I managed to solve this after some pondering.</p>

<pre><code>ffmpeg -loop 1 -i Image.jpg -i Test1.mp4 -i Test2.mp4 -filter_complex "[2:v]tpad=stop=-1:stop_mode=clone[v2]; [1:v]scale=640-20:360-20[a]; [v2]scale=320-20:180-20[b]; [0:v][a]overlay=10:(main_h/2)-(overlay_h/2):shortest=1[c]; [c][b]overlay=main_w-overlay_w-10:(main_h/2)-(overlay_h/2)[video]" -shortest -map "[video]" -map 1:a -vsync 2 Output.mp4
</code></pre>

CC BY-SA 4.0
2020-04-28T06:59:20.913Z
2020-04-28T06:59:20.913Z
DanteV.N.
<p>I am sort of new to this. I am trying to create an output video using two videos and a background image.</p>

<p><img src="https://i.sstatic.net/r1BVU.jpg" alt="End result should look like this."> With a bit of gap around the videos and Video A having a larger scale than Video B. And, it should end at Video A's duration. Therefore, Video B should be cropped to Video A's duration.</p>

<p>This is what I have managed to do so far:</p>

<p><img src="https://i.sstatic.net/PVstE.jpg" alt="Code1"></p>

<pre><code>ffmpeg -loop 1 -i Image.jpg -i Test1.mp4 -filter_complex "overlay=(W-w)/2:shortest=1" Output.mp4
</code></pre>

<p><img src="https://i.sstatic.net/IQTk5.jpg" alt="Text"></p>

<pre><code>ffmpeg -i Test1.mp4 -i Test1.mp4 -filter_complex "[0:v][1:v]xstack=inputs=2:layout=0_0|w0_h0[v]" -map "[v]" -map 1:a Output.mp4
</code></pre>

CC BY-SA 4.0
2020-04-21T05:04:18.923Z
What are the resolutions of the image, video A and video B? How long are the videos?
Gyan
CC BY-SA 4.0
2020-04-21T05:11:46.583Z
The resolution of both the image and video B is 1280x720 and the resolution of video A is 640x360. Video A is 4min 59sec and video B is 6min 5sec. I only used video A labelled as "Test1.mp4" so far.
DanteV.N.
<video><ffmpeg>
Two videos on image background
DanteV.N.
# Two videos on image background

(Asked by: username_0 on 2020-04-21)

I am sort of new to this. I am trying to create an output video using two videos and a background image.
 With a bit of gap around the videos and Video A having a larger scale than Video B. And, it should end at Video A's duration. Therefore, Video B should be cropped to Video A's duration.
This is what I have managed to do so far:

ffmpeg -loop 1 -i Image.jpg -i Test1.mp4 -filter_complex "overlay=(W-w)/2:shortest=1" Output.mp4


ffmpeg -i Test1.mp4 -i Test1.mp4 -filter_complex "[0:v][1:v]xstack=inputs=2:layout=0_0|w0_h0[v]" -map "[v]" -map 1:a Output.mp4

**Tags:** video, ffmpeg

> **Comments:**
> **username_1**: What are the resolutions of the image, video A and video B? How long are the videos?  
> **username_0**: The resolution of both the image and video B is 1280x720 and the resolution of video A is 640x360. Video A is 4min 59sec and video B is 6min 5sec. I only used video A labelled as "Test1.mp4" so far.  

---

## 1 answers

### Answer by username_0 on 2020-04-28. Score: 0

I managed to solve this after some pondering.
ffmpeg -loop 1 -i Image.jpg -i Test1.mp4 -i Test2.mp4 -filter_complex "[2:v]tpad=stop=-1:stop_mode=clone[v2]; [1:v]scale=640-20:360-20[a]; [v2]scale=320-20:180-20[b]; [0:v][a]overlay=10:(main_h/2)-(overlay_h/2):shortest=1[c]; [c][b]overlay=main_w-overlay_w-10:(main_h/2)-(overlay_h/2)[video]" -shortest -map "[video]" -map 1:a -vsync 2 Output.mp4


---

