Masking Video Tracks in KDEnlive
Put simply, Video Masking is a method of marking which parts of a video track are to be displayed and which parts are not. The concept is analogous to masks used in the GIMP image editor, in that it is a construct overlayed onto the image which defines areas of opacity/transparency in the current image.
You can also view our video section for a video tutorial about masking.
In KDEnlive, a Mask can be created as static image file, with a .pgm extension, using an image editor, such as GIMP. These files are greyscale only, with full white defining total opacity and full black defining full transparency.
The easiest way to do this is probably to edit a frame of the background image that you want to mask. Select the area that you want the foreground slide confined to and fill it with black (i.e. #000000):
Next, you need to fill the areas of the background that you want to show through with white (i.e. #ffffff). In our example, we just need to invert our selection using the GIMP option (-Photoshop also has this option):
Select → Invert
Then just fill the area with white:
Finally, save the image to disc with a .pgm extension:
The KDEnlive mask files (-known as wipes) reside (-at least in version 0.8) in the directory:
As a result, you'll need to copy your new file over to that direction before KDEnlive will pick it up, for example:
$ sudo cp <filename>.pgm /usr/share/kde4/apps/kdenlive/lumas/
Note: you'll need to assume root via sudo to access this directory. Also note that you'll have to restart KDEnlive before it will see any new wipe files
Once your new mask has been created, start KDEnlive and pull the clips into the timeline, placing the foreground clip above the background:
Next, create a transition between the two tracks and change it to composite:
In the transition parameters, select the mask you created earlier, by clicking on the drop-down box labelled Wipe File:
Finally, adjust the Opacity value until you see effect you desire in the Preview window: