From 96c8163a12e51a15faa81d3e48b80db029a408fb Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Sun, 18 Mar 2018 12:24:15 +0100 Subject: [PATCH] Add a background video behind the SBS. The video is CC0. Download from https://storage.sesse.net/flow-720.mp4 or recreate by: youtube-dl 'https://www.youtube.com/watch?v=acdWTm5P3-g' ffmpeg -i ./Blue\ Particles\ Flowing\ _\ 4K\ Relaxing\ Screensaver-acdWTm5P3-g.f313.webm -filter:v "setpts=PTS*25.0*(1001.0/30000.0),crop=w=1920:h=1080:x=640:y=320,scale=1280:720,eq=gamma=0.4" -r 30000/1001 -crf 18 -an flow-720.mp4 --- nageru/ultimate.lua | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/nageru/ultimate.lua b/nageru/ultimate.lua index ad29d6d..771a863 100644 --- a/nageru/ultimate.lua +++ b/nageru/ultimate.lua @@ -51,6 +51,8 @@ local cef_path = Nageru.THEME_PATH:match("(.*)/nageru/") local cef_input = HTMLInput.new("file://" .. cef_path .. "/score.html") cef_input:execute_javascript_async("play()") +local bg_video = VideoInput.new(cef_path .. "/flow-720.mp4", Nageru.VIDEO_FORMAT_YCBCR) + function reload_cef() cef_input:reload() cef_input:execute_javascript_async("play()") @@ -217,13 +219,16 @@ end function make_sbs_chain(input0_type, input0_overlay, input1_type, hq) local chain = EffectChain.new(16, 9) + local bg = chain:add_video_input(bg_video, false) + local input0 = make_sbs_input(chain, INPUT0_SIGNAL_NUM, input0_type == "livedeint", input0_overlay, hq) local input1 = make_sbs_input(chain, INPUT4_SIGNAL_NUM, input1_type == "livedeint", false, hq) - input0.padding_effect:set_vec4("border_color", 0.0, 0.0, 0.0, 1.0) + input0.padding_effect:set_vec4("border_color", 0.0, 0.0, 0.0, 0.0) input1.padding_effect:set_vec4("border_color", 0.0, 0.0, 0.0, 0.0) - chain:add_effect(OverlayEffect.new(), input0.padding_effect, input1.padding_effect) + local i0 = chain:add_effect(OverlayEffect.new(), bg, input0.padding_effect) + chain:add_effect(OverlayEffect.new(), i0, input1.padding_effect) chain:finalize(hq) return { @@ -740,6 +745,15 @@ function get_chain(num, t, width, height, signals) end last_resolution = input_resolution + -- Save some CPU time if we're not having SBS on live. + if live_signal_num == SBS_SIGNAL_NUM or + preview_signal_num == SBS_SIGNAL_NUM or + transition_type == ZOOM_TRANSITION then + bg_video:change_rate(1.0) + else + bg_video:change_rate(0.0001) + end + if num == 0 then -- Live. -- See if we're in a transition. finish_transitions(t) -- 2.39.2