How to remove background in video

Users often need to remove background in video and to replace it with the needed one. Our video editor enables to remove background by mask and by chosen color (chromakey). We recommend to use removal by chromakey to remove background in video, because the first method requires a lot of computer power. Let’s review example of removing background in video which was shot at home in poor lightning.

First of all you need to place a video on the scene:

Video object with blue background

After it you need to add background remover effect "Video effects->Transparent->Background remover".  For this purpose you need to open effects editing mode of the added video by clicking the object on the scene or choosing a tab with object name on timeline.

Add background removing effect

Choosing chromakey

Then you need to set the added effect the way to remove the blue background. For this purpose set "Mode" parameter in "By chromakey color" and set color of removed background. In order to set color you’d better use eyedropper tool which enables to get the needed color directly from the scene – click "Get the color from scene" in effect properties and choose a color from the scene.

 

If you chose a color incorrectly, image will be partially removed from the scene – it is the consequence of poor lightning and shadows on it:

Result of removing background

You may re-chose a color or set parameters which determine color difference in video from chromakey: "Min. brightness threshold", "Min. chromaticityU threshold" and "Min. chromaticityV threshold". These parameters set difference in brightness and chromacity in color space YUV from the sought, i.e. set subspace of possible colors. This condition strictly sets if the color will be displayed or not. But you can lighten the condition by selecting "Adaptive alfa" parameter which enables to set translucency for the colors located on the border of the two subspaces.  The following parameters - "Max. brightness threshold", "Max. chromaticityU threshold" and "Max. chromaticityV threshold" set the second subspace, and starting from the second subspace translucency is calculated for the image.

Therefore if vector of difference in color is located in the first subspace, this color will remain; but if it is also located in the second subspace, a translucency coefficient will be calculated for it; in case it is not located either in the first or in the second subspaces, the color will be replaced by the transparent one.

Translucency coefficient is calculated as follows:

R=((AlfaFactor*VLen)/64)+AlfaOffset

Where "Alfa factor", "Alfa offset" are parameters to be set,

VLen is a length of difference vector between chromakey and color at a point in UV space, i.e. brightness of the point is not considered.

Varying these parameters we obtain the following result:

Tune the effect settings

Now we need to add any image or video file to the background. For this purpose you may add any object to the scene for our edited video:

Add new background

Recommendations for creating similar video:

  • Try not to amend size of original video, because in this case neighboring colors may be mixed; use size mode without color mixing.  After background was removed (in case of unoriginal resolution of video file), objects will have the color tone of the removed background. For example in our case we used video which was automatically sized by iPhone:
    The result of resizing
  • Try to use well lightened background without shadows, because in this case the best chromakey will be selected.
  • Removed background and remaining image should have a maximum contrast. For instance in the given example you should not use red, orange and other neighboring colors as a background, because color of clothes will be blended with the background.
  • You can remove borders in video in case if background in these regions is not intercrossed with the image which you would like to leave. It enables to increase performance by reducing workable region.

You can get more information about the program on Free Video Editor' description page.