Dynamically Chroma Keying Youtube videos

Posted by user on Tuesday, September 3rd, 2024 - 7:25am

This is a simple demo of using an SVG for chroma keying a youtube video embed.

This code applies a custom color filter to a YouTube video using an SVG filter with an <feColorMatrix> element. The <feColorMatrix> transforms the colors of the video by manipulating its red, green, and blue channels according to the matrix values provided. In this case, the matrix adjusts the colors to create a "green screen" effect by altering the color intensity, which can isolate or remove specific colors.

To apply the filter, the code generates a unique ID for the filter and references it in the filter style property of the video container. The SVG filter is defined within a hidden <svg> element in the HTML, and the unique filter ID ensures that it can be applied specifically to the targeted video element without affecting other elements on the page.

Example code:

Warning! Some videos may contain flashing lights!

And here's some more random chroma keyed videos with static background images.

Here's some with animated gifs for backgrounds.

Related Posts

Creating a Selectable template

Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, […]

Using a Custom Element to create re-usable VUE apps

Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, […]

How to use Masonry in pockets

This post explores how to create a dynamic, responsive masonry layout using the v-pockets-masonry directive included in Pockets VUE that wraps Masonry.js. By combining PHP to generate randomized grid items and Vue for layout rendering, you get a flexible solution that works seamlessly with server-side data or reactive frontend content. The directive supports all Masonry.js […]