Mixing Media and a UI with Color Keying

It's possible to mix media and a user interface on the video outputs of the 4Kopen board.


This technique is a low-effort way to put various media sources "in" a user interface (e.g: hardware accelerated decode, HDMI Rx, etc...).

It is necessary to employ this technique under Raspbian, as unfortunately a large amount of the user interface is rendered with full transparency.

Note: A more ideal solution is to make use of the alpha channel, which will give you full control of the user interface's transparency.


On our Raspbian release, the color keying is configured for 0x080810 at boot (a nearly-black-gray, see /etc/init.d/st-modules).

The "transparent" color can be configured to your requirements with stmfbset:

/usr/bin/stfbset -a 255 -M 0x00000000 --color-key="1 0 0x080810 0x080810"

Once set up, anywhere that this color appears will be transparent, allowing the underlying video plane to show through.

Try the following as an example:

  • Setup an HDMI source and connect it to the HDMI Rx port
  • Follow the wiki page to configure the pipelines with media-ctl, and run hdmirx-capture
  • Show the key color somewhere on the display (for example set the background to a solid color in Raspbian)

A demonstration video is below:

V4L Interface

There is a V4L interface to manage color keying if you wish to control it from within your application.

See stmvout.h from the stlinuxtv package in the Starkl release for more details.