FFmpeg Cookbook
JA

Video Merger

Join several videos into one. Clips with matching formats can be joined by lossless copy; any other mix is re-encoded.

Your file is not uploaded
Select or drop multiple videos at once
2 or more files · MP4 / MOV / WebM / MKV
Lossless copy is for clips whose video format, resolution and audio format (sample rate and so on) all match. If a clip differs, the tool stops before joining and shows what differs. Use re-encode for those clips.
Processing… 0%

Equivalent FFmpeg command

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

ffmpeg -i in0.mp4 -i in1.mp4 -filter_complex "[0:v]scale=trunc(iw/2)*2:trunc(ih/2)*2,fps=30,setsar=1[v0];[0:a]aresample=48000[a0];[1:v]scale=trunc(iw/2)*2:trunc(ih/2)*2,fps=30,setsar=1[v1];[1:a]aresample=48000[a1];[v0][a0][v1][a1]concat=n=2:v=1:a=1[outv][outa]" -map "[outv]" -map "[outa]" -c:v libx264 -preset fast -crf 23 -pix_fmt yuv420p -c:a aac -b:a 128k -movflags +faststart output.mp4

What to do next

Popular uses
Join multiple clipsCreate social compilation videosMerge clips after trimming

How to use

  1. Add your clipsAdd two or more videos (MP4, MOV, WebM, MKV…). They are joined top to bottom.
  2. Pick a join modeChoose “Lossless copy” for clips shot on the same device with the same settings, and “Re-encode” for anything else.
  3. Set resolution & transitionRe-encode mode only. A transition can be 0.2 to 5 seconds long (0.5 seconds by default).
  4. Run the mergeA preview appears when it finishes, and you can download the result.

Recommended settings

Joining iPhone clips with identical settings
Lossless copy
When codec, resolution and audio format match, the clips join quickly without re-encoding.
Mixing screen recording + handheld footage
Re-encode · 1080p · crossfade 0.5 s
Re-encoding brings clips with different resolutions or codecs into one format.
YouTube intro + main footage
Re-encode · 1080p · no transition
With no transition, the clips are joined end to end without overlapping.

When it goes wrong

“Lossless copy cannot join these clips” appears

Cause: A clip differs from clip 1 in video format, resolution, pixel format or rotation flag, or in audio format, sample rate or channels. A copied join would break up, or play the audio slow and low, so the tool stops before joining. It also stops when the joined picture turns out to break up where the clips meet.

Fix: The join mode switches to Re-encode. Press the merge button again.

Brief freeze at clip boundaries

Cause: The earlier clip’s audio runs longer than its video, so its last frame stays on screen for the difference (in both copy and re-encode).

Fix: Before merging, trim the end of that clip to where its video ends.

Questions

How many clips can I merge?

There is no limit on the number of clips. Each file can be up to 500 MB. All clips are loaded into browser memory, so a large total can stop partway. Compress long clips first.

Can I reorder clips after adding them?

Yes. Use the ▲▼ buttons next to each row. The list order is the merge order.

What if only one clip has audio?

Choose “Re-encode”. Clips without audio get silence of the same length. Lossless copy cannot join a mix of clips with and without audio.

When does lossless copy fail?

When a clip differs from clip 1 in video format, resolution, pixel format, rotation flag, audio format, sample rate or channels, the joined file does not play correctly. The tool compares these before joining; if anything differs, it stops and switches to Re-encode. After joining, it also checks that the picture decodes where the clips meet. Frame rate is not compared (joining clips with different frame rates gives a video whose frame rate changes partway).

I want to mix portrait and landscape clips

Use Re-encode. The output takes the first clip’s orientation and shape, and clips facing the other way are fitted inside with black bars. To avoid the bars, turn them first with the SNS Video Resizer.

Crossfade vs. dissolve vs. fade through black?

Crossfade blends one clip into the next. Dissolve swaps pixels over in a random speckled pattern. Fade through black or white passes via a solid colour, which reads as a stronger scene break.

How big will the output be?

Lossless copy stays close to the sum of the inputs. Re-encode rebuilds the video as H.264 (CRF 23), which can come out smaller or larger than the originals.

More detail (settings, limits, FFmpeg commands)

What each setting means

Join mode
Lossless copy joins the clips without re-encoding (fast, no quality loss). Re-encode rebuilds everything as H.264, 30 fps and AAC (works with mixed clips).
Resolution
Output size when re-encoding: match the first clip, or 1080p, 720p or 540p (the short side). The orientation and shape follow the first clip; other clips are fitted inside with black bars. Upscaling does not improve quality.
Transition
Effect at each clip boundary: none, crossfade, fade through black or white, or dissolve.
Transition duration
Each join overlaps the two clips by this many seconds, so the result gets shorter.

Browsers and limits

  • Maximum file size: 500 MB per file (larger files are skipped)
  • Lossless copy is for clips with the same video and audio formats and resolution (the tool stops before joining clips that differ)
  • Many or long clips can run out of browser memory

The same job with the FFmpeg command line

Same-codec lossless merge (concat demuxer)
printf "file 'a.mp4'\nfile 'b.mp4'\n" > list.txt
ffmpeg -f concat -safe 0 -i list.txt -c copy out.mp4
Only for clips with the same codec, resolution, frame rate and audio format. list.txt is a text file with one file per line; you can also write it in a text editor.
Re-encode merge (concat filter)
ffmpeg -i a.mp4 -i b.mp4 -filter_complex "[0:v][0:a][1:v][1:a]concat=n=2:v=1:a=1[v][a]" -map "[v]" -map "[a]" out.mp4
Different codecs are fine, but different resolutions stop with an error. Match them with scale first.
Crossfade transition (xfade)
ffmpeg -i a.mp4 -i b.mp4 -filter_complex "[0:v][1:v]xfade=transition=fade:duration=0.5:offset=4.5,format=yuv420p[v];[0:a][1:a]acrossfade=d=0.5[a]" -map "[v]" -map "[a]" out.mp4
offset = length of a.mp4 minus the transition length (here 5 s - 0.5 s). acrossfade blends the audio. Both clips need the same resolution and frame rate.