Skip to content
Script for simulating traveling mattes with ffmpeg
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
img
notes
scripts
.gitignore
README.md
bipack.sh

README.md

bipack

Script for simulating traveling mattes with ffmpeg. Achieve the effect of bipacked film with high contrast masks with a simple bash script.

Read more about traveling mattes.

Requirements

Uses ffmpeg to generate matte layers, apply mattes as alpha masks and render the final video.

Installation instructions for ffmpeg here: https://github.com/adaptlearning/adapt_authoring/wiki/Installing-FFmpeg

Usage

sh bipack.sh A.mp4 B.mp4 matte.mp4 output.mov

This command will take video A.mp4 and B.mp4 as image sources while using matte.mp4 as a high contrast matte which seperates the two image sources. Any video passed in as the matte layer will be converted to greyscale and have the contrast maxed out, so you should treat your matte layer before putting it into this script.

bipack examples

Explaination

This script started as a multi-command experiment that finally got reduced to a single command that leans heavily on ffmpeg's maskmerge filter: Documentation

Uses 1280x720 resolution and Apple ProRes 422 HQ as the output format, right now but change that easily in the script.

Videos at different framerates will cause "slippage" between the mattes and the images, so it's best to standardize those before running this script. The default rate is set to 24fps because it's been the lowest common denominator of the videos this was written for, but you should use a consistent framerate with all videos passed into this script.

You can’t perform that action at this time.