Free, open-source AI video generator for Mac. Run LTX-2.5 and MiniMax H3 (Hailuo) locally on Apple Silicon: text-to-video and image-to-video with sound, lip-sync, character LoRA training, songs from lyrics (YuE2) and image editing (Qwen-Image-Edit). One-click install via Pinokio. Offline: no cloud, no API key, no NVIDIA GPU.
Python ai-filmmakingai-videoai-video-generatorapple-siliconhailuoimage-to-videolip-synclocal-ailora-trainingltx-2ltx-2-5ltx-videomacosminimax-h3mlxmusic-generationoffline-aipinokiotext-to-videovideo-generation
Y1.035 harden release flows and stream VAE decode
mrbizarro2ef8b93e56c0
diff --git a/README.md b/README.mdindex 3ba79ce..9eb2770 100644--- a/README.md+++ b/README.md@@ -113,12 +113,15 @@ Exported/upscaled files use the same **Output format** setting as nativerenders. Standard stays compact (`yuv420p` / CRF 18); Video production stayslossless (`yuv444p` / CRF 0).-The **Fast** export method uses ffmpeg Lanczos. The **Sharp** export method uses-PiperSR, a lightweight Apple Neural Engine 2× post-upscaler, then ffmpeg handles-the final fit/pad/encode step. The old experimental LTX latent x2 upscaler can-still be forced with `LTX_ENABLE_MODEL_UPSCALE=1`, but it is hidden by default:-the official LTX upscaler is meant to be followed by a second-stage-denoise/refinement pass, and direct decode distorted faces in release tests.+The **Fast** export method uses ffmpeg Lanczos. The optional **Sharp** export+method uses PiperSR, a lightweight Apple Neural Engine 2× post-upscaler, then+ffmpeg handles the final fit/pad/encode step. It is not bundled in the default+install because PiperSR has separate AGPL/model-license terms; install it from+the Pinokio menu only if those terms work for you. The old experimental LTX+latent x2 upscaler can still be forced with `LTX_ENABLE_MODEL_UPSCALE=1`, but it+is hidden by default: the official LTX upscaler is meant to be followed by a+second-stage denoise/refinement pass, and direct decode distorted faces in+release tests.Dev builds also include a PiperSR comparison tool for testing Sharp againstLanczos on any existing clip:@@ -470,3 +473,8 @@ commercial use.**PiperSR:** code is AGPL-3.0; model usage requires ModelPiper attributionand may require separate commercial licensing. Review its model license beforecommercial redistribution.++**Network note:** Phosphene runs locally and has no telemetry. On clean+production installs it checks GitHub every 30 minutes for an update badge, and+it reaches Hugging Face/CivitAI only when you download models or LoRAs. Disable+the update badge with `PHOSPHENE_DISABLE_VERSION_CHECK=1`.diff --git a/VERSION b/VERSIONindex b6cae40..fa474b3 100644--- a/VERSION+++ b/VERSION@@ -1 +1 @@-Y1.034+Y1.035diff --git a/install.js b/install.jsindex 219bd1d..342fcb9 100644--- a/install.js+++ b/install.js@@ -150,7 +150,7 @@ module.exports = {// than the default Python downloader for big repos like Q8 (~25 GB).// The panel sets HF_HUB_ENABLE_HF_TRANSFER=1 in download envs; if the// package is missing the hf CLI falls back gracefully with a warning.- "uv pip install --python env/bin/python pillow numpy 'huggingface-hub>=1.0' 'hf_transfer>=0.1.6' 'pipersr==1.0.0'"+ "uv pip install --python env/bin/python pillow numpy 'huggingface-hub>=1.0' 'hf_transfer>=0.1.6'"]}},diff --git a/install_sharp.js b/install_sharp.jsnew file mode 100644index 0000000..555b93a--- /dev/null+++ b/install_sharp.js@@ -0,0 +1,22 @@+module.exports = {+ run: [+ {+ method: "notify",+ params: {+ html: "<b>Installing optional Sharp upscaler.</b><br>PiperSR is AGPL-3.0 software from ModelPiper. Public/commercial redistribution may require visible attribution or separate licensing."+ }+ },+ {+ method: "shell.run",+ params: {+ message: "./ltx-2-mlx/env/bin/pip install 'pipersr==1.0.0'"+ }+ },+ {+ method: "notify",+ params: {+ html: "<b>Sharp upscaler installed.</b><br>Restart Phosphene if the Sharp button is not visible yet."+ }+ }+ ]+}diff --git a/mlx_ltx_panel.py b/mlx_ltx_panel.pyindex bb94ddd..00c0dfb 100644--- a/mlx_ltx_panel.py+++ b/mlx_ltx_panel.py@@ -127,6 +127,7 @@ PROFILE = _detect_profile()# frames in release tests, so keep it hidden unless explicitly opted in.MODEL_UPSCALE_ENABLED = _optional_bool_env("LTX_ENABLE_MODEL_UPSCALE") is TruePIPERSR_UPSCALE_ENABLED = _optional_bool_env("LTX_ENABLE_PIPERSR") is not False and importlib.util.find_spec("pipersr") is not None+VERSION_CHECK_ENABLED = _optional_bool_env("PHOSPHENE_DISABLE_VERSION_CHECK") is not True# Default port: 8198 production, 8199 dev — so both panels can run side by# side. LTX_PORT env var still overrides if the user wants something else.DEFAULT_PORT = 8199 if PROFILE == "dev" else 8198@@ -298,7 +299,7 @@ def _load_settings() -> dict:if not SETTINGS_FILE.exists():defaults = _settings_defaults()try:- SETTINGS_FILE.write_text(json.dumps(defaults, indent=2))+ _save_settings(defaults)except Exception as exc:sys.stderr.write(f"WARN: could not write {SETTINGS_FILE} ({exc})\n")return defaults@@ -790,7 +791,9 @@ def _detect_local_install_state() -> None:_VERSION_STATE["local_dirty"] = dirty# Suppress remote checks when the user is clearly running their own# variant — we'd be wrong to nag them about being "behind."- if not sha:+ if not VERSION_CHECK_ENABLED:+ _VERSION_STATE["suppress_reason"] = "disabled by PHOSPHENE_DISABLE_VERSION_CHECK"+ elif not sha:_VERSION_STATE["suppress_reason"] = "not a git checkout"elif branch != "main":_VERSION_STATE["suppress_reason"] = f"on branch '{branch}', not main"@@ -1600,8 +1603,7 @@ def _civitai_download(download_url: str, meta: dict) -> dict:"downloaded_size_bytes": bytes_written,}try:- with sidecar.open("w") as fh:- json.dump(sidecar_data, fh, indent=2)+ atomic_write_text(sidecar, json.dumps(sidecar_data, indent=2))except Exception as exc:push(f"[civitai] WARN: could not write sidecar ({exc})")return {@@ -3778,7 +3780,7 @@ class Handler(BaseHTTPRequestHandler):try:p = Path(target).resolve()base = _safe_loras_dir().resolve()- if not str(p).startswith(str(base)) or not p.is_file():+ if not p.is_relative_to(base) or not p.is_file():raise RuntimeError("path not inside loras dir")if p.suffix.lower() != ".safetensors":raise RuntimeError("not a safetensors file")@@ -5816,7 +5818,7 @@ HTML = r"""<!doctype html></div><div class="pill-group cols-2" id="upscaleMethodGroup"><button type="button" class="pill-btn active" data-method="lanczos"><span>Fast</span><span class="sub">ffmpeg Lanczos · instant</span></button>- <button type="button" class="pill-btn" data-method="pipersr"><span>Sharp</span><span class="sub">PiperSR ANE · +10-40 s</span></button>+ <button type="button" class="pill-btn" data-method="pipersr"><span>Sharp</span><span class="sub">PiperSR ANE · +30-90 s</span></button></div><input type="hidden" name="upscale_method" id="upscale_method" value="lanczos"></div>@@ -5836,15 +5838,13 @@ HTML = r"""<!doctype html><!-- Comfy-kill toggle. Hidden in DOM by default; shown only when thepanel detects ComfyUI actually running on this Mac (see updateUI- in the poll handler). Default-on when surfaced because Comfy idle- costs ~27 GB and on a 64 GB Mac that pushes 720p+ renders into- swap. The reviewer flagged the always-on hidden field as too- surprising for a public install — this version is opt-in only- when there's something to opt into. -->+ in the poll handler). Default-off for public installs: killing a+ neighboring Pinokio app should be an explicit choice, even when it+ can free a lot of memory on 64 GB machines. --><div id="comfyKillRow" class="comfy-row" style="display:none"><label class="lbl" style="display:flex; align-items:center; gap:8px; cursor:pointer">- <input type="checkbox" name="stop_comfy" id="stop_comfy" value="on" checked>- <span>Stop ComfyUI before render <span style="color:var(--muted)">(detected · frees ~27 GB)</span></span>+ <input type="checkbox" name="stop_comfy" id="stop_comfy" value="on">+ <span>Stop ComfyUI before render <span style="color:var(--muted)">(optional · can free ~27 GB)</span></span></label></div>@@ -8972,7 +8972,10 @@ if __name__ == "__main__":load_hidden()load_queue()threading.Thread(target=worker_loop, daemon=True).start()- threading.Thread(target=version_check_loop, daemon=True).start()+ if VERSION_CHECK_ENABLED:+ threading.Thread(target=version_check_loop, daemon=True).start()+ else:+ _detect_local_install_state()# Pre-flight: bind in a try/except so a busy port surfaces an actionable# one-liner instead of a 6-frame Python traceback. The bare OSError# ("[Errno 48] Address already in use") was confusing users who'd closeddiff --git a/patch_ltx_codec.py b/patch_ltx_codec.pyindex 6d981eb..84018cb 100644--- a/patch_ltx_codec.py+++ b/patch_ltx_codec.py@@ -1,7 +1,7 @@#!/usr/bin/env python3"""Idempotent patches against the ltx-core-mlx + ltx-pipelines-mlx packages.-Two upstream issues we patch around:+Upstream issues we patch around:1. Output codec is `yuv420p crf 18` — 4:2:0 chroma subsampling producesvisible JPEG-style block artifacts on faces / skin. Patched to@@ -13,6 +13,10 @@ Two upstream issues we patch around:Macs this OOMs the helper subprocess on the I2V code path. Patched toadd the same low_memory cleanup the parent has.+3. VideoDecoder.decode_and_stream advertises temporal streaming but still+ full-decodes the video tensor before writing frames. Patched to use+ temporal tiled_decode() by default, with LTX_VAE_STREAMING=0 fallback.+Known unfixed: KeyframeInterpolationPipeline OOMs at the stage-1 → stage-2transition on 64 GB Macs at full resolution. We tried freeing/reloadingthe DiT around the upscale and it didn't help. Worked around in the panel@@ -162,6 +166,91 @@ PATCH_BASE_LOAD_NEW = ''' # Stage 2: DiT (largest component — load afteself.feature_extractor = Noneaggressive_cleanup()'''+# ---- Patch 5: stream VAE decode in temporal chunks -----------------------------+# Upstream VideoDecoder.decode_and_stream() says it decodes one temporal chunk at+# a time, but the implementation still calls self.decode(latent) for the full+# video volume before writing frames to ffmpeg. On long 720p-ish clips this is+# exactly the "denoise is done, now it freezes at the end" memory-pressure tail.+# The decoder already has tiled_decode(); use temporal tiling by default while+# keeping LTX_VAE_STREAMING=0 as an emergency full-decode fallback.+PATCH_VAE_STREAM_OLD = ''' try:+ # Decode full volume and stream frames+ pixels = self.decode(latent)+ mx.async_eval(pixels)++ num_frames = pixels.shape[2]+ for i in range(num_frames):+ frame = pixels[:, :, i, :, :] # (B, 3, H, W)+ frame = mx.clip(frame, -1.0, 1.0)+ frame = ((frame + 1.0) * 127.5).astype(mx.uint8)+ # (1, 3, H, W) -> (H, W, 3)+ frame_hwc = frame[0].transpose(1, 2, 0)+ mx.eval(frame_hwc) # must be sync — async_eval can write before data is ready+ proc.stdin.write(bytes(memoryview(frame_hwc)))+ del frame, frame_hwc+ if i % 8 == 0:+ aggressive_cleanup()'''++PATCH_VAE_STREAM_NEW = ''' try:+ # PATCHED (LTX23MLX): temporal streaming decode. The old code+ # decoded the full video tensor before writing frames, causing+ # multi-minute end-of-render stalls or jetsam on long/high-res jobs.+ import os as _os+ _streaming = _os.environ.get("LTX_VAE_STREAMING", "1").strip().lower()+ _streaming_enabled = _streaming not in ("0", "false", "no", "off", "full")++ if _streaming_enabled:+ from ltx_core_mlx.model.video_vae.tiling import TilingConfig, TemporalTilingConfig++ _tile_frames = int(_os.environ.get("LTX_VAE_TILE_FRAMES", "64"))+ _overlap_frames = int(_os.environ.get("LTX_VAE_TILE_OVERLAP_FRAMES", "24"))+ _tile_frames = max(16, (_tile_frames // 8) * 8)+ _overlap_frames = max(0, (_overlap_frames // 8) * 8)+ if _overlap_frames >= _tile_frames:+ _overlap_frames = max(0, _tile_frames - 8)+ _tiling = TilingConfig(+ spatial_config=None,+ temporal_config=TemporalTilingConfig(+ tile_size_in_frames=_tile_frames,+ tile_overlap_in_frames=_overlap_frames,+ ),+ )+ _frame_index = 0+ for pixels in self.tiled_decode(latent, _tiling):+ mx.async_eval(pixels)+ num_frames = pixels.shape[2]+ for i in range(num_frames):+ frame = pixels[:, :, i, :, :] # (B, 3, H, W)+ frame = mx.clip(frame, -1.0, 1.0)+ frame = ((frame + 1.0) * 127.5).astype(mx.uint8)+ # (1, 3, H, W) -> (H, W, 3)+ frame_hwc = frame[0].transpose(1, 2, 0)+ mx.eval(frame_hwc) # must be sync — async_eval can write before data is ready+ proc.stdin.write(bytes(memoryview(frame_hwc)))+ del frame, frame_hwc+ _frame_index += 1+ if _frame_index % 8 == 0:+ aggressive_cleanup()+ del pixels+ aggressive_cleanup()+ else:+ # Emergency fallback: original full-volume decode.+ pixels = self.decode(latent)+ mx.async_eval(pixels)++ num_frames = pixels.shape[2]+ for i in range(num_frames):+ frame = pixels[:, :, i, :, :] # (B, 3, H, W)+ frame = mx.clip(frame, -1.0, 1.0)+ frame = ((frame + 1.0) * 127.5).astype(mx.uint8)+ # (1, 3, H, W) -> (H, W, 3)+ frame_hwc = frame[0].transpose(1, 2, 0)+ mx.eval(frame_hwc) # must be sync — async_eval can write before data is ready+ proc.stdin.write(bytes(memoryview(frame_hwc)))+ del frame, frame_hwc+ if i % 8 == 0:+ aggressive_cleanup()'''+# NOTE: Keyframe interpolation OOMs at the stage-1 → stage-2 transition on# 64 GB Macs. We tried free-DiT-before-upscale + reload-after-upscale; that@@ -359,6 +448,16 @@ def main() -> int:base_outcome = OUTCOME_ALREADYoutcomes.append(("base load() free feature_extractor (peanut)", base_outcome))+ # Patch 5: temporal streaming VAE decode. Required for long/high-res renders:+ # without it, decode_and_stream still materializes the whole video tensor and+ # can look like a frozen final step under memory pressure.+ vae_stream_outcome = apply_patch(+ codec_target, PATCH_VAE_STREAM_OLD, PATCH_VAE_STREAM_NEW,+ marker="PATCHED (LTX23MLX): temporal streaming decode",+ label="VAE temporal streaming decode",+ )+ outcomes.append(("VAE temporal streaming decode", vae_stream_outcome))+# (Keyframe OOM patch was removed — see NOTE in the patches block above.# The fix is currently a panel-side resolution clamp, not a pipeline edit.)diff --git a/pinokio.js b/pinokio.jsindex 4ba51d5..f776cac 100644--- a/pinokio.js+++ b/pinokio.js@@ -87,6 +87,9 @@ module.exports = {const base_ready = baseRepos.length > 0 && baseRepos.every(r => repoComplete(installRoot, r, minBytes))const q8_ready = q8Repo ? repoComplete(installRoot, q8Repo, minBytes) : false+ const sharp_ready =+ info.exists("ltx-2-mlx/env/lib/python3.11/site-packages/pipersr") ||+ info.exists("ltx-2-mlx/env/lib/python3.11/site-packages/pipersr-1.0.0.dist-info")// User-content folders persist across Reset (which only removes the venv).// Keep their shortcuts visible whenever they exist on disk so users can@@ -101,6 +104,7 @@ module.exports = {update: info.running("update.js"),reset: info.running("reset.js"),q8download: info.running("download_q8.js"),+ sharp: info.running("install_sharp.js"),}// Running states first — show what's in progress, hide everything else.@@ -108,6 +112,7 @@ module.exports = {if (running.update) return [{ default: true, icon: "fa-solid fa-rotate", text: "Updating", href: "update.js" }]if (running.reset) return [{ default: true, icon: "fa-solid fa-eraser", text: "Resetting", href: "reset.js" }]if (running.q8download) return [{ default: true, icon: "fa-solid fa-download", text: "Downloading Q8 (~37 GB)", href: "download_q8.js" }]+ if (running.sharp) return [{ default: true, icon: "fa-solid fa-wand-magic-sparkles", text: "Installing Sharp upscaler", href: "install_sharp.js" }]// No env at all → fresh install path. Recovery shortcuts to user content// folders if a previous install left files behind.@@ -158,6 +163,9 @@ module.exports = {if (!q8_ready) {baseMenu.push({ icon: "fa-solid fa-download", text: "Download Q8 (~37 GB) — High quality + FFLF", href: "download_q8.js" })}+ if (!sharp_ready) {+ baseMenu.push({ icon: "fa-solid fa-wand-magic-sparkles", text: "Install Sharp upscaler (PiperSR, optional)", href: "install_sharp.js" })+ }baseMenu.push({ icon: "fa-solid fa-rotate", text: "Update", href: "update.js" },{ icon: "fa-regular fa-circle-xmark", text: "Reset", href: "reset.js" },diff --git a/update.js b/update.jsindex 3e15b40..62991e8 100644--- a/update.js+++ b/update.js@@ -84,7 +84,7 @@ module.exports = {{method: "shell.run",params: {- message: "./ltx-2-mlx/env/bin/pip install --upgrade 'hf_transfer>=0.1.6' 'pipersr==1.0.0'"+ message: "./ltx-2-mlx/env/bin/pip install --upgrade 'hf_transfer>=0.1.6'"}},// Re-apply patches. Codec patch is required; I2V OOM patch is a no-op