FFmpeg Cookbook
JA

Side-by-Side Video Maker

Put two videos on one screen, side by side or stacked, for comparisons, before/after and reaction clips. Everything runs in your browser.

Your file is not uploaded
CLIP A (left / top)
Add Clip A
video, up to 75 MB
CLIP B (right / bottom)
Add Clip B
video, up to 75 MB
Each clip is fitted into a fixed cell (letterboxed if needed), so mixing landscape and portrait still works. The result ends when the shorter clip ends. Best with short clips — long videos are slow in the browser.
Combining… 0%

Equivalent FFmpeg command

CLI command for your current settings. Updates live as you change controls.

ffmpeg -i inA.mp4 -i inB.mp4 -filter_complex "[0:v]setpts=PTS-STARTPTS,scale=640:720:force_original_aspect_ratio=decrease,pad=640:720:(ow-iw)/2:(oh-ih)/2,setsar=1[a];[1:v]setpts=PTS-STARTPTS,scale=640:720:force_original_aspect_ratio=decrease,pad=640:720:(ow-iw)/2:(oh-ih)/2,setsar=1[b];[a][b]hstack=inputs=2:shortest=1,format=yuv420p[v]" -map "[v]" -map "0:a:0?" -c:a aac -b:a 128k -shortest -c:v libx264 -preset veryfast -crf 24 -movflags +faststart output.mp4

How to use

  1. Add two clipsDrop a video into Clip A (left/top) and Clip B (right/bottom). Each must be under 75 MB, and 120 MB in total.
  2. Choose a layoutHorizontal puts them side by side; vertical stacks them.
  3. Pick the audioUse Clip A’s audio, or mute.
  4. Combine and downloadPress Combine videos to write an H.264 MP4. Play it, then download.

When it goes wrong

The output is shorter than expected

Cause: The output ends when the shorter clip ends.

Fix: Trim both clips to the same length first.

One side has black bars

Cause: The clip’s shape does not match its cell, so the empty space is filled with black instead of stretching the picture.

Fix: Use clips with the same orientation, or crop them to the cell shape first. Each horizontal-layout cell (640×720) is taller than it is wide, so 16:9 landscape clips get bars above and below.

It runs out of memory or is very slow

Cause: Both videos are decoded and re-encoded inside the browser tab.

Fix: Use short clips of a few seconds. On a phone, aim for about 50 MB per clip (a notice appears above 50 MB).

Questions

Can I combine a landscape and a portrait video?

Yes. Each clip is scaled to fit its cell and the rest is filled with black, so different orientations combine without stretching.

How long does the combined video run?

As long as the shorter clip. To show both clips in full, trim them to the same length first.

Whose audio is used?

Clip A’s audio, or none. The tool cannot mix the two tracks. To add music, make the video without audio and then use the Add BGM / Audio Mix Tool.

What resolution is the output?

1280×720 for horizontal and 720×1280 for vertical.

Are my videos uploaded?

No. Everything runs in your browser with ffmpeg.wasm, and the files are not sent anywhere.

More detail (settings, limits, FFmpeg commands)

What each setting means

Layout
Horizontal = 1280×720, two 640×720 cells. Vertical = 720×1280, two 720×640 cells.
Audio
Keep Clip A’s audio (if it has any) as AAC 128 kbps, or make the result silent.

Browsers and limits

  • Browser memory limits this to short clips: each input under 75 MB, and 120 MB in total.
  • Only two layouts (horizontal or vertical, two equal cells). Free positioning and picture-in-picture are not available.

The same job with the FFmpeg command line

Horizontal side-by-side (1280×720)
ffmpeg -i a.mp4 -i b.mp4 -filter_complex "[0:v]setpts=PTS-STARTPTS,scale=640:720:force_original_aspect_ratio=decrease,pad=640:720:(ow-iw)/2:(oh-ih)/2,setsar=1[a];[1:v]setpts=PTS-STARTPTS,scale=640:720:force_original_aspect_ratio=decrease,pad=640:720:(ow-iw)/2:(oh-ih)/2,setsar=1[b];[a][b]hstack=inputs=2:shortest=1,format=yuv420p[v]" -map "[v]" -map "0:a:0?" -c:v libx264 -crf 24 -preset veryfast -c:a aac -b:a 128k -movflags +faststart -shortest out.mp4
Uses Clip A’s audio. setpts=PTS-STARTPTS starts both clips at time 0.
Vertical stacked (720×1280)
ffmpeg -i a.mp4 -i b.mp4 -filter_complex "[0:v]setpts=PTS-STARTPTS,scale=720:640:force_original_aspect_ratio=decrease,pad=720:640:(ow-iw)/2:(oh-ih)/2,setsar=1[a];[1:v]setpts=PTS-STARTPTS,scale=720:640:force_original_aspect_ratio=decrease,pad=720:640:(ow-iw)/2:(oh-ih)/2,setsar=1[b];[a][b]vstack=inputs=2:shortest=1,format=yuv420p[v]" -map "[v]" -an -c:v libx264 -crf 24 -preset veryfast -movflags +faststart out.mp4
Muted output.