Skip to main content

How to create Video Templates?

This is a manual on how create video templates using After Effects packages in Marvia.

Written by Maarten Peters

Preparing an After Effects project

1. When applicable, click on Source Name to display the Layer Name.

2. You can rename layer names for a clearer overview in templates by right-clicking on a layer and selecting Rename.

3. The Composition Name is used to select the right composition in the Template Studio. Multiple compositions can be added to a project (for example, for different Facebook formats), making it easy to reuse the same ZIP file for multiple templates.


Specific requirements

- Variable text must use an TTF font

A TTF font should be installed on the computer with After Effects when adding text. The same font needs to be uploaded into the Font Library in Marvia (Settings > Platform > Font Library).


- Non-variable layers should be pre-composed

If you plan to use a video (e.g., as a background) or text without a font available in the Marvia Font Library, these non-variable elements must be pre-composed.

  1. Select the non-variable layers you wish to combine.

  2. Right-click on the selected layers.

  3. Select Pre-compose.

Note: Be aware that all selected layers are merged into a single layer. Only select the non-variable content that belongs together, otherwise they will overlap or be overlapped by the variable layers. Do not include any variable layers in the pre-composition, as they will lose their functionality.


- Variable images that should scale

Scale to fill background

If you want a variable image to fill the full background:

  1. Add a default background image, name it Background.

  2. Press the 'S' key to reveal its Scale property.

  3. Alt-click (Windows) or Option-click (Mac) on the stopwatch icon next to the Scale property to open the expression editor.

  4. Copy and paste the following expression into the editor:
    ​
    const originalScale = value;

    const compWidth = thisComp.width;

    const compHeight = thisComp.height;

    const sourceWidth = thisLayer.source.width;

    const sourceHeight = thisLayer.source.height;

    const widthRatio = compWidth / sourceWidth;

    const heightRatio = compHeight / sourceHeight;

    const fillRatio = Math.max(widthRatio, heightRatio);

    const finalX = originalScale[0] * fillRatio;

    const finalY = originalScale[1] * fillRatio;

  5. The expression will automatically scale the image to fill the background. If the image isn't perfectly centered, adjust its position to the middle of the composition.


​Scale to fit


If you want a variable image to fit within certain dimensions, for example a logo:

  1. Add a Solid to box the maximum dimensions of the image, name it Logo Shape.

  2. Duplicate this layer and rename the new layer to Logo.

  3. Hide the Logo Shape layer.

  4. Select the Logo layer and press the 'S' key to reveal its Scale property.

  5. Alt-click (Windows) or Option-click (Mac) on the stopwatch icon next to the Scale property to open the expression editor.

  6. Copy and paste the following expression into the editor


    // Replace "Logo Shape" with the name of your solid layer
    targetLayer = thisComp.layer("Logo Shape");
    targetSize = targetLayer.sourceRectAtTime(time,false);
    imageSize = sourceRectAtTime(time,false);
    ​
    targetRatio = targetSize.width / targetSize.height;
    imageRatio = imageSize.width / imageSize.height;
    ​
    if (imageRatio > targetRatio) { scaleFactor = (targetSize.width / imageSize.width) * 100;
    } else { scaleFactor = (targetSize.height / imageSize.height) * 100;
    ​

Saving an After Effects project
​
​ 1. Go to File > Dependencies > Collect File


​2. Use these settings and click Collect…

3. Save the folder with your project files, ZIP the contents of that folder (do not ZIP the folder itself), and you’re ready to use it for your template

Did this answer your question?