Last updated: November 29, 2024

<span aria-hidden="true" id="major-performance-improvements-for-audio-and-video-concatenation"></span>

# Major performance improvements for audio and video concatenation

![Tim Koschützki](/assets/images/teammates/avatar-tim-kos-1.jpg?dpl=dpl_DM8JrFduDL1oLK4J3qc9o5gMffMy)

**Tim Koschützki**

Co-founder · Berlin, Germany · Show bio

[](https://x.com/tim%5Fkos)[](https://github.com/tim-kos)

We have recently updated our audio and video concatenation Robots to make use of FFmpeg's[concat muxer⁠](https://trac.ffmpeg.org/wiki/Concatenate#demuxer), resulting in a significant improvement in performance for applicable Assemblies.

For Assemblies to take advantage of the new muxer, the input files need to meet the following conditions:

* Encoded in the same format (e.g. all MP4s).
* Use the same codecs for their streams (e.g. H.264 for video and AAC for audio).
* Have the same codec parameters (such as resolution, frame rate for video, or sample rate for audio).

![Transloadit Robots working together to form an Assembly](/_next/static/immutable/media/assembly-line@2x.373f9uwk_w_zu.png)

<span aria-hidden="true" id="why-its-much-faster"></span>

## Why it's much faster

Concatenating with the concat muxer is much faster than using complex filters and retranscoding for several reasons:

<span aria-hidden="true" id="no-re-encoding-required"></span>

### No re-encoding required

When using the concatenation muxer with `-c` copy, FFmpeg doesn't need to decode and then re-encode the streams. Re-encoding is a CPU-intensive process that can significantly increaseAssembly execution time, especially for Assemblies processing high-resolution video. By avoiding this step, the concat muxer avoids unnecessarily re-encoding the files, completing the Assembly much faster.

<span aria-hidden="true" id="direct-data-copying"></span>

### Direct data copying

The concat muxer essentially allows FFmpeg to directly copy the media data from the source files to the output file. Since there's minimal processing involved (other than parsing the file headers and adjusting timestamps), the operation is limited primarily by the speed of the storage media.

<span aria-hidden="true" id="preserves-quality"></span>

### Preserves quality

Since there's no re-encoding, there's also no quality loss from compression artifacts that might be introduced during the encoding process. This is an added benefit beyond the speed improvement.

In contrast, using complex filters or re-encoding requires FFmpeg to fully decode all streams, process them (which might include scaling, filtering, or other transformations), and then re-encoding them into the target format. This not only takes more time but can also degrade quality and increase file size.

This approach is similar to [LosslessCut⁠](https://github.com/mifi/lossless-cut), an open-source video editor created by our own Transloadian[Mikael Finstad](/about.md#mikael). LosslessCut also uses FFmpeg's concat demuxer for fast, lossless video editing.

***

To make the most of this change, make sure to first transcode differing input files to the same format, codec and resolution. For best performance here, use `turbo: true` and one of our[presets](/docs/presets/video.md). With both of these, you can greatly improve execution time on your existing Assemblies.

If input files are of the same format, codec and resolution anyway, there is no need to add any additional encoding Steps as you should already be noticing the performance improvements by default. However if your files may be in different formats, codecs or resolutions, we recommend adding a [/file/filter](/docs/robots/file-filter.md) Step to pass outlier files to an encoding Step, so that you can get the most out of your later concatenationSteps.

[#api](/blog/tags/api.md)[#assembly](/blog/tags/assembly.md)[#workflow](/blog/tags/workflow.md)[#file-filter-robot](/blog/tags/file-filter-robot.md)

### 👩‍💻 Join 20k+ developers

Sign up for our [monthly newsletter](/newsletters.md) to receive direct links to 3 exclusive tech — and 2 product updates. No less, no more.

Your email:

Get access

## File uploading and encoding. Made simple.

Transloadit streamlines file handling for developers, trusted by brands like Coursera and The New York Times. We’re known for a reliable API, top-notch support, and a strong commitment to open source, with projects like [Uppy⁠](https://uppy.io) and [Tus⁠](https://tus.io) setting standards in file processing.

[Sign up](/c/)[Book a Demo](https://survey.typeform.com/to/kRg47Xi5)

No credit card needed

Cancel anytime
