aboutsummaryrefslogtreecommitdiff
path: root/mkdiscooverlay
blob: 920536b3760bc9a8be484fde7c3d7b93f4bf2b2d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/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()