12.05.2026, 19:51
Quick and Dirty: just running all frames through the server:
with this I get ~4s/frame
Cu Selur
# Imports
import sys
import os
import vapoursynth as vs
# getting Vapoursynth core
core = vs.core
# Limit frame cache to 48449MB
core.max_cache_size = 48449
# Import scripts folder
scriptPath = 'F:/Hybrid/64bit/vsscripts'
sys.path.insert(0, os.path.abspath(scriptPath))
# loading plugins
core.std.LoadPlugin(path="F:/Hybrid/64bit/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/fmtconv.dll")
core.std.LoadPlugin(path="F:/Hybrid/64bit/Vapoursynth/Lib/site-packages/vapoursynth/plugins2/libbestsource.dll")
# Import scripts
import validate
# Source: 'G:\TestClips&Co\files\test.avi'
# clip current meta; color space: YUV420P8, bit depth: 8, resolution: 640x352, fps: 25, color matrix: 470bg, color primaries: Unspecific, color transfer: Unspecified, yuv luminance scale: limited, scanorder: progressive, full height: true ((Source))
# Loading 'G:\TestClips&Co\files\test.avi' using BestSource
clip = core.bs.VideoSource(source="G:/TestClips&Co/files/test.avi", cachepath="J:/tmp/test_bestSource", track=0, hwdevice="opencl")
import xmlrpc.client
import io
import numpy as np
from PIL import Image
clip_rgb = core.resize.Bicubic(clip, format=vs.RGB24, matrix_in_s="470bg")
proxy = xmlrpc.client.ServerProxy("http://127.0.0.1:8765/", use_builtin_types=True)
PROMPT = "Colorize this black and white image with natural, realistic colors."
def frame_to_png_bytes(f):
w, h = f.width, f.height
# VapourSynth R55+: planes are accessed with frame[plane]
r = np.asarray(f[0])
g = np.asarray(f[1])
b = np.asarray(f[2])
arr = np.dstack([r, g, b])
img = Image.fromarray(arr, "RGB")
buf = io.BytesIO()
img.save(buf, format="PNG")
return xmlrpc.client.Binary(buf.getvalue())
def write_png_to_frame(fout, png_bytes_data):
out_img = Image.open(io.BytesIO(bytes(png_bytes_data))).convert("RGB")
out_arr = np.array(out_img)
for plane_idx in range(3):
np.copyto(np.asarray(fout[plane_idx]), out_arr[:, :, plane_idx])
# Process pairs: frame N and N+1 together
# Use FrameEval with a clip-of-clips approach, or simply process even frames
# and carry the paired result. A simpler approach for offline encoding:
num_frames = clip_rgb.num_frames
results = {} # cache colorized frames
def colorize_paired(n, f):
if n in results:
return results.pop(n)
fout = f.copy()
# Get frame n
png1 = frame_to_png_bytes(f)
# Get frame n+1 (if exists)
n2 = min(n + 1, num_frames - 1)
f2 = clip_rgb.get_frame(n2)
png2 = frame_to_png_bytes(f2)
fout2 = f2.copy()
result = proxy.colorize_frame_pair(png1, png2, PROMPT, 8)
# gap_px=8 is the separator between the two images during inference
if result["ok"]:
write_png_to_frame(fout, result["data1"])
write_png_to_frame(fout2, result["data2"])
if n2 != n:
results[n2] = fout2 # cache the second result
return fout
colorized = core.std.ModifyFrame(clip_rgb, clip_rgb, colorize_paired)
output = core.resize.Bicubic(colorized, format=vs.YUV420P8, matrix_s="470bg")
output.set_output()with this I get ~4s/frame
2026-05-12 19:44:26,630 [INFO] colorize_frame_pair: 13.94s (6.97s/frame)
100%|████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:03<00:00, 1.64s/it]
2026-05-12 19:44:54,805 [INFO] colorize_frame_pair: 7.55s (3.78s/frame)
100%|████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:03<00:00, 1.63s/it]
2026-05-12 19:49:00,028 [INFO] colorize_frame_pair: 8.40s (4.20s/frame)
100%|████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:03<00:00, 1.73s/it]
2026-05-12 19:49:37,091 [INFO] colorize_frame_pair: 8.01s (4.00s/frame)
100%|████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:03<00:00, 1.64s/it]
2026-05-12 19:49:44,713 [INFO] colorize_frame_pair: 7.48s (3.74s/frame)
100%|████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:03<00:00, 1.64s/it]
2026-05-12 19:49:52,345 [INFO] colorize_frame_pair: 7.49s (3.75s/frame)
100%|████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:03<00:00, 1.67s/it]
2026-05-12 19:50:00,027 [INFO] colorize_frame_pair: 7.54s (3.77s/frame)
100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:03<00:00, 1.63s/it]
2026-05-12 19:50:07,564 [INFO] colorize_frame_pair: 7.40s (3.70s/frame)
100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:03<00:00, 1.66s/it]
2026-05-12 19:50:15,198 [INFO] colorize_frame_pair: 7.50s (3.75s/frame)
100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:03<00:00, 1.67s/it]
2026-05-12 19:50:22,959 [INFO] colorize_frame_pair: 7.62s (3.81s/frame)
100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:03<00:00, 1.67s/it]
2026-05-12 19:50:30,665 [INFO] colorize_frame_pair: 7.56s (3.78s/frame)
100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:03<00:00, 1.63s/it]
2026-05-12 19:50:38,270 [INFO] colorize_frame_pair: 7.46s (3.73s/frame)
100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:03<00:00, 1.63s/it]
2026-05-12 19:50:45,998 [INFO] colorize_frame_pair: 7.58s (3.79s/frame)
100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:03<00:00, 1.68s/it]
2026-05-12 19:50:53,992 [INFO] colorize_frame_pair: 7.84s (3.92s/frame)Cu Selur
----
Dev versions are in the 'experimental'-folder of my GoogleDrive, which is linked on the download page.
Dev versions are in the 'experimental'-folder of my GoogleDrive, which is linked on the download page.

