Session 19: Mattes and masters

Preparation

  • Please download this content here.

Description

This tutorial defines the methods of creation – and the rationale behind – mattes and masters, in order to streamline performance for clips that contain transparency and high bitrates.

Session specific objectives

Evaluate and generate mattes and masters for use in Swift.

Chapter 1: Matte and master rationale

  • A look at an example
  • Reduce performance bottlenecks
  • Reduce data rates
  • Optimise graphical performance

Chapter 2: Creating a matte and master from prepared assets

  • Using the Matte Shader option on preview drag

Chapter 3: Creating a matte with FFMPEG

  • Creating a matte using ffmpeg (gray 256 col)

Expected duration

20 minutes

User Level

All new users

Evaluating Quicktime movies

These movies may contain an alpha channel.

To check the data rate of your movie:

  1. Open the movie in a Quicktime player
  2. Go > Show Window (Ctrl I)
  3. Go > Show Movie Inspector
  4. View the Data Rate setting in mbits/sec

We recommend that the bitrate should be lower than 100 mbits/sec

 

Evaluating other movies

These movies do not support an alpha channel

To check the bitrate of your movie:

  1. Open the movie in VLC
  2. Go > Tools
  3. Go > Media Information
  4. Select the Statistics tab
  5. View the Input and Content bitrates in kbits/sec

We recommend that the bitrate should be lower than 50 mbits/sec

 

Using matte and master movie clips

If your movie's data rate is too high, the following become requirements:

  • You will require a master (or foreground) movie clip
  • You will require a matte (or alpha) movie clip

The approach will be to use both of these two clips in Swift (or Edit 3d) on the same shader:

  • Texture 0: This is the default Texture slot used to set movies on
  • Texture 1: This is the default Texture slot used only when a matte is set

 

Step 1: Creating a master video clip

If you are using Adobe Media Encoder, we recommend:

H264 with: Same as source

Set a Target bitrate of less that 50

In our supplied example LowBitrate.mp4, the default Target bitrate of 10 was set in Media Encoder.

 

Step 2: Creating a matte movie

In our example image sequence supplied (below), the matte must be created so that the black areas will be the areas that we use to “punch” through to reveal the “master”.

Using ffmpeg to create a matte movie

ffmpeg can create a Quicktime grayscale movie of only 256 colours.

Open a command prompt

  • Shift-Right-click inside the folder that contains your images
  • Select the Open command window here option

 

Converting your image sequence

Copy this ffmpeg command - inserting into it - the correct name of your image:

ffmpeg -f image2 -i "MatteExample_%05d.png" -vcodec qtrle -pix_fmt gray MatteExample.mov

 

Image sequence number

Image sequences are always numbered before the file extension. We need to tell ffmpeg how many digits the sequence name carries.

For a sequence filename that begins: MatteExample_00001.png, the command is:

“MatteExample_%05d.png”

Where ffmpeg is instructed to look for 5 decimal places in each of the image sequence files.

 

Output file name

The output file name in the command is the final component. In the example above, the output name is:

  • MatteExample.mov
  • The file will be rendered to the same folder as the image sequence.

 

Session Project

If you want to review Justin Avery's instructor project at this point in the course, you can download the project zip here.