Adding a spotlight effect to a video using Blender


Recently I needed to add a spotlight effect to a video to highlight and follow a particular object in the scene. Blender is a fantastic piece of software which comes with a built-in video sequence editor. Fiddling around in Blender, I managed to come up with a solution which works quite well. I'm not sure if it's the best way to accomplish this so if you're aware of a better method please let me know.

Requirements

  1. Blender - Blender is a free and open-source 3D computer graphics software which includes a video sequence editor. It's cross-platform so no matter what desktop operating system you are running you should be able to use it.

  2. A video file to which you want to add a spotlight effect.

The desired result

For the purposes of demonstrating this effect I used a short clip from the 1935 Looney Tunes animated film Hollywood Capers, where Beans the Cat sneaks into a Hollywood studio disguised as Oliver Hardy. The video below shows the result.

Setting up blender

The first thing we need to do is set up Blender for video editing.

  1. Open Blender and select the Video Editing item on the splash screen.

    Blender splash screen

  2. The default workspace for video editing will be displayed, as shown below.

    Blender video editing workspace

    There are five areas in the default video editing view:

    1. File Browser
    2. Video Sequencer - Preview
    3. Properties
    4. Video Sequencer - Sequencer
    5. Timeline

Loading the video

  1. In the File Browser, navigate to the video you want to edit and then drag it onto the Sequencer area. If your video has sound, two strips will be displayed in the Sequencer area, a blue strip for the video and an aqua strip for the audio.

    Blender with video added

  2. In the Sequencer area in the image above, you can see a thin, vertical black line just after the eight second mark. This line represents the end of the playback range, which in my case is roughly in the middle of the video. If we were to play the video, it would restart after eight seconds, never reaching the end. The playback range can be adjusted by setting the Start and End fields, located at the far right of the Timeline area. In this example, setting the End frame to 411 aligns the playback range with the length of the video.

  3. We will use the Movie Clip Editor to draw the spotlight effect. As we no longer require the File Browser we can load the Movie Clip Editor in its place. Each area in Blender can display any of the available editors. As shown in the image below, click the Editor Type button (always the left most button in the header of an editor) and choose Movie Clip Editor.

    The Editor Type menu in Blender

    Blender will now look like the following:

    Blender with the Movie Clip Editor loaded

  4. Before going any further, let's reset the playhead to the beginning of the video. This can be done by dragging the playhead back to the first frame or by using the shortcut Shift + Left Arrow.

  5. Now click the Open button in the header of the Movie Clip Editor and select the same video file you opened in step 1.

    Blender with a video loaded in the Movie Clip Editor

Drawing the spotlight

We can achieve the spotlight effect by adding a mask in the Movie Clip Editor. Then, in each frame of the video, we can ensure the mask is positioned over the object that we want in the spotlight. The following steps illustrate how to do this.

  1. Change the editing context from Tracking to Mask, either by selecting Mask from the Editing Mode menu (shown below) or by pressing the Tab key.

    Blender with the Movie Clip Editor Editing Mode menu open

  2. Once in Mask mode, click the Add menu in the header of the Movie Clip Editor and select Circle.

    Blender with the Movie Clip Editor Editing Mode menu open

    A circle shape will then appear in the lower left corner of the clip.

    Blender with a circle mask added

  3. To position the mask over the subject, press the G key to activate the Move transformation mode and then move your mouse. The mask will move with the mouse. Left click the mouse to exit the Move transformation mode. If you accidentally deselect the mask you can select it again by pressing the A key, which is the shortcut for Select All.

    Blender with the circle mask positioned

  4. The mask is now positioned correctly but it needs to be a little bigger. With the circle shape selected (press the A key if it isn't) press the S key, which is the shortcut for Scale transformation mode. When in the Scale transformation mode, moving your mouse away from the centre of the selected object will increase its size and moving your mouse towards the centre of the selected object will decrease its size. Once the circle covers the subject, left click the mouse to exit the Scale transformation mode.

    Blender with the circle mask scaled

  5. Now that the mask in place, click the Auto Keying button, which is the record button in the centre of the Timeline header. With Auto Keyframe enabled, Blender will automatically insert keyframes for objects.

  6. Now we just need to move through the video frame by frame and move and scale the mask so it always encircles the subject. You can move backward and forward one frame at a time by pressing the Left Arrow and Right Arrow keys respectively.

    Note: It's not necessary to adjust the position and size of the mask in every frame. If the subject is moving in a straight line, as is Beans for the first 106 frames, you can jump to the frame before the subject changes direction or stops moving and position and size the mask accordingly.

    The following video shows an example of the mask moving with the subject.

Once you have finished tracking the subject with the mask, the next step is to apply the mask to the video in the Video Sequencer.

Adding the mask to the Video Sequencer

At the moment, the mask is only in the Movie Clip Editor. In this section we'll add the mask to the video that we have loaded in the Video Sequencer.

  1. In the Sequencer area, select the video strip (the blue coloured strip) by clicking it with the left mouse button and then make a duplicate either by right clicking the strip and selecting Duplicate or pressing the Shift + D shortcut. The copy of the strip will move with your mouse. Place the strip in an empty channel by left clicking the mouse. The image below shows the duplicate video strip in channel number three.

    Blender with a duplicate video strip

  2. With the original video strip selected, open the Modifiers panel (the highlighted area in the image below).

    Blender with the Video Sequencer modifier panel open

  3. Click the Add Strip Modifier drop down list in this panel and select Mask.

  4. In the mask modifier that appears, select the Mask Input Type.

  5. Click in the Mask field and select F Mask. This is the mask that we created in the Movie Clip Editor. The modifier panel should now look like the following:

    Blender with a mask modifier selected

We have now added the mask to the video in the sequencer; however, it's currently hidden by the duplicate video strip in channel three. In the next section we'll blend these two strips together so Beans is in the spotlight.

Revealing the mask

  1. Select the duplicate video strip in channel three.

  2. Then, open the Strip panel, which is located in the Sequencer's properties pane, just above the Modifiers panel.

  3. We now need to adjust the Opacity slider which is located under Adjust > Compositing, changing the opacity to somewhere around 0.5. Feel free to play with this value to get the desired contrast between the spotlit area and the rest of the video. The image below shows the adjusted opacity.

    Blender with the strip opacity set

  4. Play the video, either by clicking the Play button, located in the centre of the Timeline header, or by pressing the Space shortcut key. In the Video Sequencer Preview area you should now see the spotlight following the subject.

Rendering the video

Now that we have create the spotlight effect we just need to render the final video.

  1. Open the Properties editor and set the Output field to the directory where the final video should be saved and the File Format field to FFmpeg video.

    Blender showing the output settings

  2. In Blender's Topbar menu click Render and then Render Animation. The render window will appear and can be closed once the rendering is complete. You will now have a video file in the directory you specified in step 1.

Conclusion

As you can see, it's quite straightforward to add a spotlight effect to a video using Blender. I haven't explored other ways to accomplish this so if you're aware of a better way please let me know.