Skip to content

Video and Audio

m4bwav edited this page Nov 15, 2026 · 4 revisions

Every video command writes the exact frames in <out>_frames/, an H.264 mp4 (yuv420p, CRF 18) and <out>.json with an animation block (keyframes, fps, duration). All take --size WxH (even numbers for H.264), --fps and --duration. They need ffmpeg. Every video is flash checked before it is reported.

zoom

Exponential width from the recipe's width (or --from-width) to --to-width, with an eased centre move when --to-centre re,im is given.

python fw.py zoom seahorse --to-width 0.001 -o zoom.mp4 --size 160x90 --fps 12 --duration 1
wrote zoom.mp4, zoom.json and 12 frames
note: AI styling off (default; --ai to turn on): exact video
flashcheck: pass (flashing together: 10% general, 0% red of a 10-degree field, limit 25%; whole-frame 1 swings/s)

For Mandelbrot deep zooms on the CPU, render --deep --series (since 0.7.0, opt-in) adds series approximation to perturbation: it skips the first iterations, probe-checked against plain perturbation. Deep zooms render much faster on the GPU with --route browser (since 0.3.0; double-float deltas since 0.5.0, --gpu-precision float32 for the older shader). See Explorer for how exact it is.

python fw.py zoom seahorse --to-width 1e-14 -o gzoom.mp4 --size 160x90 --fps 6 --duration 1 --route browser
wrote gzoom.mp4, gzoom.json and 6 frames
note: AI styling off (default; --ai to turn on): exact video
flashcheck: pass (flashing together: 0% general, 0% red of a 10-degree field, limit 25%; whole-frame 1 swings/s)

morph

Moves a parameter along keyframes: the Julia c by default, another one with --vary.

python fw.py morph julia-rabbit --path "-0.12,0.75;-0.8,0.156" -o morph.mp4 --size 160x90 --fps 12 --duration 1
wrote morph.mp4, morph.json and 12 frames
note: AI styling off (default; --ai to turn on): exact video
flashcheck: pass (flashing together: 0% general, 0% red of a 10-degree field, limit 25%; whole-frame 2 swings/s)

loop

A closed path (--circle re,im,r, optional --phase) whose last frame wraps to the first, so the video loops without a seam.

python fw.py loop julia-rabbit --circle 0,0,0.7885 -o loop.mp4 --size 160x90 --fps 12 --duration 1
wrote loop.mp4, loop.json and 12 frames
note: AI styling off (default; --ai to turn on): exact video
flashcheck: pass (flashing together: 0% general, 0% red of a 10-degree field, limit 25%; whole-frame 2 swings/s)

The AI styling pass

Off by default since 0.2.2: zoom, morph, loop and audio write the exact video only, which is the preferred output. Pass --ai to add a styled copy; --no-ai is still accepted and means the default.

Flag Meaning
--ai run the img2img pass after the exact render
--ai-prompt TEXT img2img prompt
--ai-denoise D denoise in (0, 1], default 0.3; checked before anything renders
--ai-seed N sampler seed, the same for every frame

When a ComfyUI host in FW_COMFY_HOSTS answers (default the local ports 8188 and 8199), each exact frame goes through Z-Image Turbo img2img (Apache 2.0) with one fixed seed. The added texture is smoothed over time so it does not flicker, and the result is written as <out>_ai.mp4, <out>_ai_frames/ and <out>_ai.json, marked interpreted with the model, licence, prompt, denoise, seed and flicker.

python fw.py zoom seahorse --to-width 0.001 -o zai.mp4 --size 160x90 --fps 12 --duration 1 --ai --ai-prompt "stained glass" --ai-denoise 0.25 --ai-seed 7

With no host reachable (this run set FW_COMFY_HOSTS="") the run stays exact and says so:

wrote zai.mp4, zai.json and 12 frames
note: AI styling: no ComfyUI host reachable, exact video kept
flashcheck: pass (flashing together: 10% general, 0% red of a 10-degree field, limit 25%; whole-frame 1 swings/s)

A denoise outside the range stops the run before rendering (exit 1):

python fw.py zoom seahorse --to-width 0.001 -o bad.mp4 --ai --ai-denoise 1.5
--ai-denoise must be in (0, 1]

The exact frames and video are always kept. A host error records ai_pass.status: failed and keeps the exact video. A busy GPU is waited on in its queue for up to FW_AI_TIMEOUT_S seconds (default 1800).

flashcheck

Runs alone on a video or a frame folder; the video commands run it for you. It applies the WCAG 2.x general flash and red flash thresholds: the frame is cut into a grid of cells, and the cells that flash more than 3 times a second must cover no more than 25% of any box a third of the screen wide and high (341x256 at 1024x768). A small blinking region passes; a full-screen strobe fails. It exits 4 on a failure.

python fw.py flashcheck zoom.mp4
frames: 12
fps: 12.0000
swings: 2
max_swings_per_s: 2
limit_per_s: 3
luminance_range: [0.274, 0.455]
general_flash_area: 0.0989
red_flash_area: 0.0000
area_limit: 0.2500
max_cell_flashes_per_s: 4.0000
async_flash_area: 0.0989
failed_rules: []
pass: True
flashcheck: pass (flashing together: 10% general, 0% red of a 10-degree field, limit 25%; whole-frame 2 swings/s)
...
method: WCAG 2.x general and red flash thresholds: per-cell swing walk on a 36x48 grid, ...

Since 0.6.0 the area rule counts only cells that flash together (their swings within one frame of each other); async_flash_area reports cells flashing out of step, which is moving detail rather than one flash, and does not fail a video. The verdict line comes first and last, and failed_rules names the rule a failing video broke. A last method: line names the rule. max_swings_per_s is the older whole-frame count, kept for reference. A video that fails is reported, not shipped.

audio

A music video from a song. Envelopes (bands, loudness, onsets, beats, chroma) come from musicwright's mw.py envelopes when an installed musicwright has it, else from a built-in NumPy fallback, and the recipe says which. Bass swells the Julia c and pulses the zoom, beats kick it (at most about 3 a second), mids drift the colour, chroma sets the hue, treble the palette density, and loudness drives mandel-dive's zoom travel. Nothing moves in silence.

Options: --preset julia-pulse|mandel-dive, --recipe R, --size, --fps, --duration, --intensity 0.6, --route auto|browser|numpy, and the AI pass flags. Frames pass a flash limiter, then flashcheck (exit 4 on a failure), and ffmpeg muxes the song cut to the frame count. MP3 is refused unless --allow-mp3.

python fw.py audio song.wav -o song.mp4 --size 160x90 --fps 12 --duration 2 --route numpy
wrote song.mp4, song.json and 24 frames
note: envelopes: musicwright at <path>/mw.py has no usable envelopes command (...); internal fallback
note: route: numpy
note: AI styling off (default; --ai to turn on): exact video
flash limiter damped 0 frames; flashcheck: pass (flashing together: 0% general, 0% red of a 10-degree field, limit 25%; whole-frame 0 swings/s)

song.wav here is a two-second test tone. fw.py serve also serves a live page at /audio (a file or the microphone, the same mappings and a flash limiter, behind a photosensitivity warning); see Explorer.

Clone this wiki locally