How to speed encoding on Linux

Dear Community,

My workstation has 32 GB of RAM, 2 Sata SSD drives, i5 11400F CPU and an old AMD Radeon HD 7770 graphics card.
With a 4K project, system went out of RAM - I had to restart to Shotcut before encoding several times…
With 1080 projects, RAM isn’t an issue…
Could someone point me out the best option to speed up encoding?
Thanks.

J.

What specific flavour of Linux are you running? I will asume your OS is using systemd for the moment. First do a reboot for testing then check swappiness. Open a terminal and type:
cat /proc/sys/vm/swappiness
If that fails you might need to run the command with sudo:
sudo cat /proc/sys/vm/swappiness

If it is the default which is usually 60, then change to something like 10. Temporary method for testing is as follows:
sudo sysctl vm.swappiness=10

Then open Shotcut and do your 4k export. If things are better you can make the change permanent. More details on that and how to do it here:
https://www.baeldung.com/linux/optimize-performance-efficiency-speed

But it will probably help if we know your actual OS and version e.g. Ubuntu 22.04, Mint, Manjaro, Fedora etc.

Here is the documentation to run encoding without the GUI:
This will save you a good portion or RAM.
running melt without GUI
Fast Encoding depending heavily on GPU encoders or you try to encode with mp4 the predecessor of h264.

3 Likes

I’m running Linux Mint 21.3. I will try that. I did that in the past for system optimisation…

Sharing the test results:

Shotcut version 24.09.13

libx264
Quality-base VBR
Quality 55% - crf=23
GPO 150 frames
B frames 3

Video length 03:58:19
6 video layers
4 audio layers

swappiness=60

GUI export=00:04:13

swappiness=10

GUI export=00:04:12

CLI export=00:04:23

libx265
Quality-base VBR
Quality 55% - crf=23
GPO 150 frames
B frames 3

GUI export=00:05:04

Are you willing to take a mild image quality drop to get more speed, or willing to allow larger file sizes to get more speed?

A common technique with libx264 is to add the line preset=veryfast to the Other tab on Advanced export. Depending on the source material, the image quality difference may be imperceptible, but the encoding speed should be noticeably faster.

2 Likes

Hi Austin,

Thank you for your suggestion.
The results are interesting:

156.4 MB - 4:12 - default
98.9 MB - 2:53 - veryfast
154.3 MB - 2:44 - superfast
190.0 MB - 2:37 - ultrafast

On a 22" monitor, I can’t tell the difference.
Lowering encoding time is good news and 34 MBytes is nothing nowadays.

Thanks for all the input. Much appreciated.

Kind regards,
J.

1 Like

No RAM problems? You can use something like htop or btop to monitor those on the fly.

But with 4k video and 32Gb RAM (which seems plenty), If I were you I would get into the habit of always closing and re-opening shotcut before doing a large export. That takes a very short amount of time and can save out of memory warnings.

If you have too many items in your project (videos usually longer than 20 minutes) than Shotcut can run out of memory even with 32 GBs. In this case you should split the video in more parts and export them with the same codec and resolution settings as the end master video containing the edited part videos.

Hi PoisonedSlice,

Definitely no RAM problems otherwise I would have system crashes.
Htop and other tests always came out fine.
I guess I will consider a RAM upgrade. It is cheaper that buying a video editor.
I will definitely will stick with Shotcut!

Kind regards,
J.

Hi Alex007,

That’s a way of doing things.
There’s also a way to concatenated projects - I saw that somewhere else…
Usually the “problematic” projects are less than 5 minutes long but have multiple layers (up to 10)…
I’d rather prefer to have everything in one screen…
Many thanks.

Kind regards,
J.

1 Like

This topic was automatically closed after 90 days. New replies are no longer allowed.