A zero exit code is not a valid join. Normalize resolution, frame rate, sample rate and channel count first, then join with the concat filter and verify duration, frame count, dimensions and decode errors.
The join that looked successful
Three clips, three resolutions, three frame rates and three audio formats. A concat list feeds them to FFmpeg with stream copy. The command finishes with exit code 0. If the only check is “did FFmpeg complain?”, the job looks done.
The clips were synthetic H.264/AAC MP4s with burned-in labels so the source of each section would be visible. Clip A was 640×360 at 30 fps with 90 frames and 48 kHz stereo audio. Clip B was 480×480 at 25 fps with 60 frames and 44.1 kHz mono. Clip C was 360×640 at 24 fps with 84 frames and 32 kHz stereo. Their durations were 3.0, 2.4 and 3.5 seconds.
| Clip | Resolution | Frame rate | Frames | Audio | Duration | Bytes |
|---|---|---|---|---|---|---|
| A | 640×360 | 30 fps | 90 | 48 kHz stereo | 3.0 s | 415,800 |
| B | 480×480 | 25 fps | 60 | 44.1 kHz mono | 2.4 s | 294,044 |
| C | 360×640 | 24 fps | 84 | 32 kHz stereo | 3.5 s | 465,737 |
The naive duration sum is 8.9 seconds. On a common 30 fps timeline, the expected frame count is 267: A keeps 90 frames, B contributes 72 after 25-to-30 conversion, and C contributes 105 after 24-to-30 conversion. Those expectations are arithmetic, not a quality judgment.
The header described the first clip, not the whole file
The direct command used a concat list and -c copy. It exited 0. The output was 7.141 seconds, not 8.9. It had 234 video frames, not 267. Its audio lasted 5.955 seconds, losing about one third of the expected duration. The file was 1,172,430 bytes.
| Measurement | Expected | Direct concat | Difference |
|---|---|---|---|
| Container duration | 8.900 s | 7.141 s | −1.759 s (−19.8%) |
| Video frames | 267 | 234 | −33 (−12.4%) |
| Audio duration | 8.900 s | 5.955 s | −2.945 s (−33.1%) |
| Decode errors | 0 | 108 AAC errors | +108 |
| Mux-time DTS warnings | 0 | 97 | +97 |
The 234 frames are exactly 90 + 60 + 84. No frames were dropped by a frame-rate converter; no converter ran. The output header says 640×360 at 30 fps because it describes the first clip. A decoder that actually reads the later packets produces 60 frames at 480×480 and 84 frames at 360×640. A player that trusts the header may crop, stretch, reject those frames or show a corrupted transition.
The audio is worse. The muxer's final progress line reported about 5.95 seconds, not 8.9. Decoding the file produced 108 errors of the form “Number of scalefactor bands in group exceeds limit” and “Error submitting packet to decoder.” The file is not repaired because the container opens.
Why stream copy cannot conform mismatched clips
Stream copy moves encoded packets. It does not decode, scale, resample or change a frame rate. Each packet belongs to a stream with its own codec parameters, dimensions, sample rate and time base. The concat demuxer can rewrite some timestamps and concatenate byte ranges, but it cannot make later packets obey the first clip's sequence parameters.
With matching inputs, a direct concat is efficient and sensible. With mismatched inputs, “matching” has to include more than the container extension: codec profile and level, resolution, pixel format, frame rate, time base, sample rate, channel layout, and encoder delay. A phone clip at 29.97 fps and a screen recording at 30 fps may look close and still carry different time bases. A 48 kHz stereo track and a 44.1 kHz mono track are not interchangeable just because both are AAC.
The 97 non-monotonic DTS warnings are a symptom. The muxer is trying to place packets from different time bases on one timeline. The 108 AAC errors are another. A successful mux is not a successful decode, and a successful decode is not proof that the timeline is correct.
Normalize each clip onto one grid
The clean approach converts every clip to the same canvas, frame rate, pixel format, sample rate and channel count before joining. The test used a 640×360, 30 fps, 48 kHz stereo grid. The video chain was:
scale=640:360:force_original_aspect_ratio=decrease:force_divisible_by=2,
pad=640:360:(ow-iw)/2:(oh-ih)/2,
setsar=1,
fps=30scale fits the source inside the canvas without changing its aspect ratio. pad fills the remaining area with black. setsar=1 makes the pixel aspect ratio square, and fps=30 produces a constant 30 fps timeline. The 4:3 clip becomes pillarboxed; the portrait clip becomes a narrow image inside a landscape canvas. No source pixels are cropped, but the black bars are part of the result.
Audio was converted to 48 kHz stereo AAC at 192 kb/s. The normalized intermediates were re-encoded H.264, not copies. That is the cost of conformance: generation loss. The test did not measure perceptual quality against the inputs.
| Normalized clip | Bytes | Container duration | Frames | Video duration | Audio duration |
|---|---|---|---|---|---|
| A | 497,468 | 3.008 s | 90 | 3.000 s | 3.008 s |
| B | 238,883 | 2.415 s | 72 | 2.400 s | 2.415 s |
| C | 253,407 | 3.520 s | 105 | 3.500 s | 3.520 s |
Frame conversion is not free. B's 60 frames at 25 fps become 72 at 30 fps; C's 84 at 24 fps become 105. The converter duplicates and drops frames to fit the new grid. Fast motion can show judder. The alternative is to choose a common rate that matches the most important clip, or to keep the clips separate and cut between them instead of joining.
Join the normalized clips with the concat filter
With conformed inputs, use the concat filter and map its video and audio outputs:
ffmpeg -i a.mp4 -i b.mp4 -i c.mp4 -filter_complex "[0:v:0][0:a:0][1:v:0][1:a:0][2:v:0][2:a:0]concat=n=3:v=1:a=1[v][a]" -map "[v]" -map "[a]" -c:v libx264 -preset medium -crf 18 -pix_fmt yuv420p -c:a aac -b:a 192k -ar 48000 -ac 2 -fps_mode cfr -r 30 -t 8.9 -movflags +faststart joined.mp4The output measured 8.900 seconds, 267 frames, 640×360, 30 fps, 48 kHz stereo, and zero decode errors. It was 965,404 bytes: 207,026 bytes smaller than the broken direct join even though it is 1.759 seconds longer. The direct file was larger because it carried mismatched payloads and malformed timing, not because it contained more useful video.
The explicit -t 8.9 trims the output to the expected timeline. Without a duration cap, encoder delay and audio priming can add a few milliseconds or a frame at the end. The test also tried the concat demuxer after normalization: it produced 9.057 seconds, 269 frames and an odd 120 fps report. That is a boundary effect, not the expected timeline. The published clean file uses the filter and the cap.
If the clips are truly identical in codec parameters and time base, the demuxer plus stream copy is still the efficient route. The rule is not “always re-encode.” The rule is “do not stream-copy a format change you did not make.”
Verify the timeline, not the exit code
A join check should read the output, not the console's last line. Inspect the container and stream durations, the video frame count, the coded dimensions, the frame rate, the audio sample rate and channel count, and the number of decode errors. A compact ffprobe pass gets most of that:
ffprobe -v error -count_frames -show_entries format=duration:stream=codec_type,width,height,r_frame_rate,sample_rate,channels,nb_read_frames -of json joined.mp4Then decode the whole file with errors visible and watch the boundaries. A player may hide a bad transition by dropping frames. Check the last frame of A, the first frame of B, and the corresponding audio. If the source clips have speech or a clap, listen for a gap or a repeated word at each seam.
Frame count is a useful checksum, not a quality score. A 267-frame file can still have the wrong frames, a bad crop or an audio offset. Compare a few boundary frames and confirm that the portrait clip is pillarboxed rather than stretched. The normalized test kept all source pixels and added bars; a crop-based workflow would remove pixels and should be chosen deliberately.
When a direct concat is the right choice
Direct concat is appropriate when the clips came from the same camera or export preset, with the same codec, profile, resolution, frame rate, pixel format, audio layout and time base. It is also appropriate when the edit is a simple sequence of identical clips and a re-encode would only add generation loss. Test a short join and verify the boundary before committing to a long one.
It is not appropriate for mixed phone footage, screen recordings, downloaded clips and camera files without a conformance step. Even when the container extension matches, the streams may not. The measured failure here was not subtle, but a milder mismatch can produce a file that plays while dropping a few frames or drifting at the seams.
The browser tool set does not include a joiner. Use an editor for a mixed-source timeline, or conform and join with FFmpeg or another tool that exposes the settings. Normalize first, join second, and verify third. The order matters more than the specific command.
Download the 480×480 input · Broken direct join · Normalized join
Inspect the actual source structure before another join
The join-readiness workbench compares local clips in order and exposes details a resolution label leaves out: audio clocks and layouts, time bases, stream order, codec configuration and sampled timestamps. Its findings are screening evidence, not a promise of a valid concatenation. The newer matching-dimensions case demonstrates a successful command with an unexpected container duration, then records a deliberate SDR normalization plan. If your clips contain several soundtracks, decide which to keep before generating the first-track plan.
Common questions
Why did FFmpeg exit successfully if the join is broken?
Exit code 0 means the process completed. It does not mean the packets share codec parameters or that the timeline is coherent. The direct output still had 108 AAC decode errors and was 1.759 seconds short.
Can I join clips with different resolutions using stream copy?
Not safely. Stream copy cannot scale or change frame rate. The output header may describe the first clip while later frames keep their original dimensions. Normalize first if the clips differ.
Should I crop or pad a portrait clip?
Padding keeps all source pixels and adds bars. Cropping fills the frame but removes pixels. Neither is universally right; choose by what the shot needs and check the result.
Why does the normalized join have black bars?
The test fits each source inside a 640×360 canvas without changing aspect ratio, then pads the empty area. The portrait 360×640 clip becomes a narrow image inside the landscape frame.
Is the concat demuxer always wrong?
No. It is designed for inputs with matching parameters. The test deliberately used mismatched inputs. With identical streams, the demuxer and stream copy can be the efficient choice.
Sources & further reading
Written for ToolWillow with original explanations and examples. Consult current product documentation for controls that vary by version.



