Render Kdenlive Projects on Headless Linux Server

This guide explains how to use Kdenlive’s “Generate Script” feature to render video projects on a remote, headless Linux server. By exporting a rendering script and the project’s MLT XML file from your desktop, you can offload the CPU-intensive rendering process to a dedicated command-line environment using the MLT framework.

Step 1: Generate the Rendering Script in Kdenlive

Before moving to your headless server, you must generate the rendering script using the Kdenlive GUI on your local machine.

  1. Open your project in Kdenlive.
  2. Click the Render button in the top toolbar (or press Ctrl + Enter).
  3. Select your desired output format, quality, and encoder settings.
  4. Instead of clicking “Render to File”, click the Generate Script button at the bottom of the render dialog.
  5. Choose a destination folder and save the script. Kdenlive will generate two essential files: a shell script (.sh) and a project description file (.mlt or .xml).

Step 2: Prepare the Headless Linux Server

Your headless server needs the MLT multimedia framework installed, as Kdenlive relies on the melt command-line utility to process renders.

  1. Connect to your server via SSH.

  2. Update your package manager and install melt (along with any necessary codecs). On Debian/Ubuntu-based systems, run:

    sudo apt update
    sudo apt install melt kdenlive-data ffmpeg

    Note: Installing the full kdenlive package on a headless server is usually unnecessary, but installing melt is required.

Step 3: Transfer Files to the Server

You must transfer the project files, the source assets, and the generated scripts to the headless server.

  1. Transfer your source footage, audio files, and images to the server.
  2. Transfer the .sh script and the accompanying XML/MLT file.
  3. Important: Keep the directory structure identical to your local machine, or open the XML file and the .sh script in a text editor to update the file paths of your source assets to match their new location on the server.

Step 4: Execute the Render Script

Once the files are on the server and paths are verified, you can start the rendering process.

  1. Navigate to the directory containing your transferred script:

    cd /path/to/your/render/folder
  2. Make the generated shell script executable:

    chmod +x render_script.sh
  3. Run the script:

    ./render_script.sh

Troubleshooting: Virtual Framebuffers

Because Kdenlive and MLT sometimes require visual libraries (like Qt) to initialize certain effects, the script might fail on a strictly headless server without a display server.

If you encounter display-related errors, install xvfb (X Virtual Framebuffer) to simulate a graphical display in the background:

sudo apt install xvfb
xvfb-run ./render_script.sh

This commands wraps the rendering process in a virtual display environment, allowing the command-line render to complete successfully.