#
Create a frame for a PiP

In CINELERRA-GG it is quick and easy to create Picture-in-Picture (PiP) using the Camera and Projector tools. You can read about how to use these at Camera and Projector.

PiPs created with Camera and Projector, however, do not have a frame. You can add it with the Sketcher plugin that allows for drawing on the canvas of the Compositor window. Such a frame remains fixed in the position where it was created and can only be moved manually, with a movement that must be in accordance with the movement of the PiP. Unfortunately, this is very complicated and imprecise work. A convenient workaround is to use the Sketcher plugin together with the Crop&Position plugin. Here is a description of how to do this.

Consider an example of a main video (bbb_sunflower_1080p_30fps_ normal.mp4) and a still image example (Rodents.png). You want to insert a crop of the image surrounded by a colored frame inside the video. Later you can move the PiP with its frame by using keyframes.

1. First, create a project with 3 video tracks. From top to bottom name them: V3_Frame 4Picture, V2_Picture, V1_Video.
2. In V1_Video put the video file. In V2_Picture put the image (extending it to the length of the video by simply dragging the right edge) - or you can put another video instead of a still image. The V3_Frame4Picture track is left empty.
3. In V2_Picture, if needed put the Scale plugin, and then 2 separate Crop&Position plugins. The Scale plugin may be needed to scale the image - maybe to use it with the Camera tool, however it is not needed for the creation of the frame and PiP. Depending on its use, you can put it in the first or second position in the plugin stack. The first Crop&Position plugin (the topmost one, which is processed first in Temporary and whose output becomes the input to the next plugin) will be used only to make the desired crop for our image (Crop Only). The second Crop&Position plugin will be used to place the PiP in the desired position (Position Only).
4. In V3_Frame4Picture, select the length of the video track and apply the Sketcher plugin. Either highlight the region in which to apply the plugin or assign In/Out Points, because you can not add plugins to an empty track. Now add the Shared Effects of the Crop&Position plugin, taking care to choose the second plugin (Position Only) which is further down the stack (for shared effects see: Shared Effects and Shared Tracks).

This is what the timeline should look like:

            - V3_Frame4Picture
                    -> Sketcher
                    -> Shared V2_Picture:Crop&Position (Position ONLY)
            - V2_Picture
                    -> Rodents.png
                    -> Crop&Position (Crop ONLY)
                    -> Scale
                    -> Crop&Position (Position ONLY)
            - V1_Video
                    -> bbb_sunflower_1080p_30fps_normal.mp4

as you can see in figure D.9.

Figure D.9: Setting effects

All that remains is to create the frame on the image that has already been cropped to the desired size. Drawing the frame with the Sketcher plugin is not difficult but requires precision. You can draw the 4 corner points imprecisely (Shift + LMB) and then arrange the created points by dragging them to exactly the right coordinates (Ctrl+LMB), or you can impose the coordinates on the 4 corner points by entering the exact numbers in the X and Y Input windows. You can also adjust the thickness of the frame and the color (see Sketcher).

If you want to move the PiP to another position you have to go back to Crop&Position (Position Only) and change the coordinates. Now you can see that the frame also moves along with the image thanks to the Shared effect present in the V3_Frame4Picture track, which returns the same coordinates to the Sketcher plugin.

Finally, you can animate the position of the PiP as well as the thickness and color of the frame throughout the video using the keyframes (see Keyframes).