Generate stream test frames as uint8 (#183689)

This commit is contained in:
Erwin Douna
2026-09-30 09:40:31 +02:00
committed by GitHub
parent d4cf1837b1
commit 9d2cb13b9c
+7 -7
View File
@@ -53,13 +53,13 @@ def generate_audio_frame(pcm_mulaw=False):
@functools.lru_cache(maxsize=1024)
def frame_image_data(frame_i, total_frames):
"""Generate image content for a frame of a video."""
img = np.empty((480, 320, 3))
img[:, :, 0] = 0.5 + 0.5 * np.sin(2 * np.pi * (0 / 3 + frame_i / total_frames))
img[:, :, 1] = 0.5 + 0.5 * np.sin(2 * np.pi * (1 / 3 + frame_i / total_frames))
img[:, :, 2] = 0.5 + 0.5 * np.sin(2 * np.pi * (2 / 3 + frame_i / total_frames))
img = np.round(255 * img).astype(np.uint8)
return np.clip(img, 0, 255)
color = [
np.round(
255 * (0.5 + 0.5 * np.sin(2 * np.pi * (c / 3 + frame_i / total_frames)))
)
for c in range(3)
]
return np.full((480, 320, 3), color, dtype=np.uint8)
def generate_video(encoder, container_format, duration):