How to concatenate multiple videos into one file in Linux in GUI without re-encoding (HEVC and other video formats)

Table of contents

1. How to make one video file from several videos

2. How to combine multiple HEVC videos into one file

3. The difference between combining video files without re-encoding and combining video with encoding

4. Download a program to combine videos into one file. How to install LosslessCut

5. How to combine videos into one file in LosslessCut

6. How to create chapters for YouTube (chapter transition timestamps)

How to make one video file from several videos

I needed to join several separate video files into one file in order to upload it to YouTube as one video.

This operation is simple – any, even the simplest video editor can handle combining files into one. But I would like to do without re-encoding. That is, I don’t want the video files to be re-encoded into one format or another – I just want to merge the video files into one large video file. No editing, no lengthy processing and encoding of the video stream.

How to combine multiple HEVC videos into one file

Moreover, I use the HEVC (High Efficiency Video Coding) video format.

This video format allows you to reduce the video size by half without losing quality. But some time-tested video editors cannot work with it.

So, I need to merge several HEVC files into one video. How can this be done very quickly without putting a strain on computer hardware?

See also: How to enable saving videos in HEVC in Android to reduce file size

The difference between combining video files without re-encoding and combining video with encoding

By merging files without re-encoding, extremely high processing speeds are achieved. Moreover, during processing there is no load on the CPU or GPU and the final speed of creating a new file depends primarily on the speed of the SSD. For example, on my computer, a new 8 GB file from several videos is created in just a few seconds. Encoding (depending on hardware, source and output formats) would take from several minutes to several hours. It is also worth noting that repeated lossy encodings can lead to deterioration in picture quality.

But combining files without re-encoding also has a limitation: all merged files must be in the same format and have the same settings (for example, video resolution).

An example of video files that can be combined without video re-encoding: several videos shot with the same camera settings.

Example of video files that cannot be combined without video re-encoding: videos with 4K and 8K resolution cannot be combined into one video. In this case, you will definitely need to re-encode, and you will need to select the final format and resolution of the output file: 4K or 8K or some other.

Download a program to combine videos into one file. How to install LosslessCut

An excellent program that allows you to merge videos is LosslessCut.

In fact, LosslessCut has many other useful features, many of which allow you to perform actions on video without the need for re-encoding and, therefore, without loss of quality (lossless).

Official website of the program: https://github.com/mifi/lossless-cut

The easiest and most universal way to install LosslessCut is to download the portable version from the official website. To do this, go to https://github.com/mifi/lossless-cut/releases and download the LosslessCut-linux-x86_64.AppImage file for the latest release.

Note: The following executables are available for different Linux architectures:

  • x64 tar.bz2
  • x64 AppImage
  • arm64 tar.bz2
  • Raspberry Pi armv7l

Then unpack the archive.

To run a program, you must make the file executable. You can do this in the GUI:

Or on the command line, to do this, go to the directory with the program and run the command:

chmod u+x LosslessCut-linux-x86_64.AppImage

Now you can launch the program by double clicking.

If you want to remove LosslessCut, all you need to do is delete the file – the application is portable.

In distributions based on Arch Linux, you can install the program from the AUR, for example, using pikaur this can be done as follows:

pikaur -S losslesscut-bin

See also: Automatic installation and update of AUR packages

You can install LosslessCut from the app stores:

How to combine videos into one file in LosslessCut

1. Launch LosslessCut

2. Open the videos you want to merge. The easiest way to do this is to select all the files and drag them into the program window.

If you add files one at a time, then for the second added file you need to select “Merge/concatenate with current file”; and for the third and all subsequent files you need to select “Add the file to the batch list”.

3. Now click on the “Merge/concatenate files…” icon.

4. Before you continue, consider enabling two options.

First, pay attention to the “Check compatibility” option. This option will allow you to make sure that all files have the same codec and resolution and hence the output file will play without any problem.

The second option can be enabled by clicking on the “Options” button. Here you can enable the “Create chapters from merge segments (slow)” setting. This setting will create chapters that you can switch between in the media player, and it will also allow you to quickly create timestamps for YouTube.

5. If desired, you can edit the “Output file name” and then click the “Merge!” button.

Creating a single video file is very fast (especially on fast SSD drives).

How to create chapters for YouTube (chapter transition timestamps)

1. First, when exporting, enable the already mentioned above option “Create chapters from merge segments (slow)”.

2. Import the output file to LosslessCut.

3. From the LosslessCut menu, select “File” → “Export project” → “Start time as YouTube Chapters”:

4. A window with the following data will be displayed:

0:00 20240709_184647
0:22 20240709_190427
0:31 20240709_190440
1:28 20240709_192730

Each line here is a chapter of a YouTube video.

The first part of the line (before the space) is the start time of the next chapter (section) of the YouTube video. If desired, you can delete chapters or edit times.

The second part of the line is the title of the chapter. You can choose any chapter names; by default, the chapters are named the same as the files that make up that part of the video.

Example of edited data:

0:00 In the park
0:22 Viewpoint
0:31 On the way
1:28 Parking

5. Upload the video to YouTube. In the “Description” section, add the data you copied from LosslessCut.

As a result, when watching a video, the contents of its chapters and time stamps will be shown, which will allow you to quickly switch between sections of the video.

Leave Your Observation

Your email address will not be published. Required fields are marked *