#!/usr/bin/env lua function hue2rgb(hue) local h = hue * 6 local x = math.floor((1.0 - math.abs(h % 2.0 - 1.0)) * 255) return table.unpack(({ {255, x, 0}, {x, 255, 0}, {0, 255, x}, {0, x, 255}, {x, 0, 255}, {255, 0, x}, })[math.floor(h)+1]) end local fps = 25 local dur = 2 local out = "discooverlay.mkv" local encoder = io.popen("ffmpeg -f rawvideo -pixel_format rgb24 -video_size 1x1 -framerate "..fps.." -i - -y "..out, "w") local total = fps*dur for i = 0, total-1 do encoder:write(string.char(hue2rgb(i/total))) end encoder:close()