<p>Use</p>

<pre><code>ffmpeg -i activity.mp4 -i mobile.mp4 -filter_complex " nullsrc=size=2560x720 [base];[0:v] setpts=PTS-STARTPTS, scale=1280x720 [upperleft]; [1:v] setpts=PTS-STARTPTS, scale=1280x720 [upperright]; [base][upperleft] overlay=shortest=1 [tmp1]; [tmp1][upperright] overlay=x=720" -c:v libx264 output.mp4
</code></pre>

<p>The <code>shortest</code> should be applied only to the first overlay.</p>

<p>Also, you can skip scale for the video which is already 1280x720. This output will only audio from one of the inputs.</p>

CC BY-SA 4.0
2018-11-07T15:44:48.110Z
Your command gives me the same output as before! Did you forget to change anything?!
angel_30
CC BY-SA 4.0
2018-11-07T15:47:41.797Z
Command corrected.
Gyan
CC BY-SA 4.0
2018-11-07T15:48:48.153Z
No still not working. I guess `x=1280` for `shortest` which works now.
angel_30
CC BY-SA 4.0
2018-11-07T15:58:57.030Z
Heh. I did not check your co-ordinates.
Gyan
CC BY-SA 4.0
2018-11-07T15:37:41.423Z
2018-11-07T15:47:11.177Z
2018-11-07T15:47:11.177Z
Gyan
<p>I'm trying to concat two videos, side by side, using ffmpeg. One of them is <code>1280x720</code>, and the other <code>1920x1080</code>. One will be left, one will be right side. The higher resolution will be resized to the lower resolution one.</p>

<p>What is the command to do that?</p>

<p>I tried this command (they used 4 videos, I tried to edit it for 2), but somewhere is wrong and it cuts the first video:</p>

<pre><code>ffmpeg -i activity.mp4 -i mobile.mp4 -filter_complex " nullsrc=size=2560x720 [base];[0:v] setpts=PTS-STARTPTS, scale=1280x720 [upperleft]; [1:v] setpts=PTS-STARTPTS, scale=1280x720 [upperright]; [base][upperleft] overlay=shortest=1 [tmp1]; [tmp1][upperright] overlay=shortest=1:x=720" -c:v libx264 output.mp4
</code></pre>

CC BY-SA 4.0
2019-05-30T04:25:40.607Z
https://unix.stackexchange.com/questions/233832/merge-two-video-clips-into-one-placing-them-next-to-each-other/521878#521878
Sanjay Hadiya
<video><ffmpeg><video-editor><editing><encoding>
Concat two MP4 files (side by side) with FFmpeg
angel_30
# Concat two MP4 files (side by side) with FFmpeg

(Asked by: username_0 on 2018-11-07)

I'm trying to concat two videos, side by side, using ffmpeg. One of them is 1280x720, and the other 1920x1080. One will be left, one will be right side. The higher resolution will be resized to the lower resolution one.
What is the command to do that?
I tried this command (they used 4 videos, I tried to edit it for 2), but somewhere is wrong and it cuts the first video:
ffmpeg -i activity.mp4 -i mobile.mp4 -filter_complex " nullsrc=size=2560x720 [base];[0:v] setpts=PTS-STARTPTS, scale=1280x720 [upperleft]; [1:v] setpts=PTS-STARTPTS, scale=1280x720 [upperright]; [base][upperleft] overlay=shortest=1 [tmp1]; [tmp1][upperright] overlay=shortest=1:x=720" -c:v libx264 output.mp4

**Tags:** video, ffmpeg, video-editor, editing, encoding

> **Comments:**
> **username_1**: https://unix.stackexchange.com/questions/233832/merge-two-video-clips-into-one-placing-them-next-to-each-other/521878#521878  

---

## 1 answers

### Answer by username_2 on 2018-11-07. Score: 2 | Accepted answer

Use
ffmpeg -i activity.mp4 -i mobile.mp4 -filter_complex " nullsrc=size=2560x720 [base];[0:v] setpts=PTS-STARTPTS, scale=1280x720 [upperleft]; [1:v] setpts=PTS-STARTPTS, scale=1280x720 [upperright]; [base][upperleft] overlay=shortest=1 [tmp1]; [tmp1][upperright] overlay=x=720" -c:v libx264 output.mp4

The shortest should be applied only to the first overlay.
Also, you can skip scale for the video which is already 1280x720. This output will only audio from one of the inputs.

> **Comments:**
> **username_0**: Your command gives me the same output as before! Did you forget to change anything?!  
> **username_2**: Command corrected.  
> **username_0**: No still not working. I guess `x=1280` for `shortest` which works now.  
> **username_2**: Heh. I did not check your co-ordinates.  

---

