Skip to content
Artificial intelligence. Clearly. RSS feed
AI NEWS AI

News. Evidence. Perspective.

Build & CodeExplainer

Put a moving subject on a new background with Kdenlive

Use an AI object mask to isolate a short piece of footage, place it over a colour clip and render an MP4. This guide carries the edit through to a file you can play outside the editor.

A moving toy or puppet can become the foreground of a new scene. Kdenlive’s Object Mask uses Meta’s Segment Anything Model 2, or SAM 2, to isolate it. The mask supplies the boundary; the video editor lets you decide what appears behind it.[5][6]

This is a walkthrough of the current Kdenlive manual, including its setup screenshots, rather than an edit we have executed. Start with your own short clip—around five seconds is a useful practice length—with the subject visible throughout. The finished result here is an MP4 showing that subject over a solid colour.

Install the editor and its object model

Kdenlive is free software. Its current download is version 26.08.2, with a Windows installer requiring Windows 10 or newer. The site also provides Linux and macOS builds. The setup below follows the Windows controls shown in the manual.[1][2]

Install Python 3.10 or newer if needed, using the official Python installer and selecting Add python.exe to PATH. In Kdenlive, open Settings > Configure Kdenlive > Plugins > Object Detection. Choose Install when the plugin prompt appears. Use Download models to install an offered SAM2 model, then select it in Model.[3][6]

Choose CPU under Device for this first attempt. GPU processing requires a detected CUDA-capable Nvidia GPU. Wait until the configuration reports that object segmentation is configured. The plugin and model downloads need an internet connection and storage; they are separate from installing the editor.[3]

Build the mask on the source clip

Create a project with File > New and choose a project folder. Add your video through Add Clip or Folder in the Project Bin. Kdenlive can suggest a matching project profile when the first clip is added. The Clip Monitor displays the source; the Project Monitor displays your assembled edit.[4]

  1. Select the video in the Project Bin. In the Clip Monitor, set the zone’s in point at the first frame and its out point at the end of your short clip.
  2. Choose Create an Object mask, then Create New Mask.
  3. Drag a rectangle around the subject and click to identify it. Shift-click adds a part; Ctrl-click excludes an area.
  4. Choose Generate Mask and wait. Select the resulting mask, preview it and use the edit control if its outline needs correction.
  5. Choose Apply Mask. Kdenlive applies it through the Shape Alpha effect.
[5]

Inspect the subject at the start, middle and end of the movement. A narrow gap between a puppet’s arm and body is a useful place to check: the background should show through the gap while the arm remains visible. If the selection includes part of the table, correct that area before building the composite.

Give the subject a background

Right-click an empty area of the Project Bin and choose Add Color Clip. Name it, choose a contrasting colour and set its duration to match your practice clip. The duration field uses hours, minutes, seconds and frames.[7]

Drag the colour clip onto video track V1 and the masked subject onto V2 directly above it. Align their starts at the beginning of the timeline and their ends at the same point. Use only the stretch covered by the generated mask. Timeline clips can be shortened by dragging their edges.[4][8]

Kdenlive automatically takes alpha—the transparency created by the mask—into account when clips are stacked. The colour underneath should therefore appear around the subject. Play the Project Monitor to check the combined result. A strongly contrasting background makes a stray patch or missing edge easier to see before choosing the final colour.[8]

Save the editable project with File > Save. A .kdenlive project records the arrangement and effects; the playable movie comes from the rendering step.[4]

Render the file you will actually use

  1. Open File > Render, or press Ctrl+Enter.
  2. In Output file, choose a folder and a name such as puppet-on-blue.mp4.
  3. Under Generic, choose MP4-H264/AAC. Select Full project if the timeline contains only your completed short edit.
  4. Choose Render to File and wait for the job to finish. Open the output folder and play the saved MP4.
[9]

Check the beginning and end for an unintended blank stretch, then watch the subject’s edges through the whole movement. This MP4 contains the background you composed into it. Kdenlive has separate Video with Alpha presets when a later project needs a transparent intermediate file.[9]

Follow the evidence

Sources & further reading

  1. Kdenlive KDE · Accessed 19 Oct 2026
  2. Download the latest version KDE · Accessed 19 Oct 2026
  3. Plugins: Object Detection Kdenlive manual · Accessed 19 Oct 2026
  4. Quick Start Kdenlive manual · Accessed 19 Oct 2026
  5. Object Mask Kdenlive manual · Accessed 19 Oct 2026
  6. Segment Anything Model 2 Meta · Accessed 19 Oct 2026
  7. Color Clip Kdenlive manual · Accessed 19 Oct 2026
  8. Compositions Kdenlive manual · Accessed 19 Oct 2026
  9. Rendering Kdenlive manual · Accessed 19 Oct 2026