How the Picture-in-Picture Tool Works
AnyTool composites a picture-in-picture overlay in the browser with a self-hosted single-threaded ffmpeg.wasm engine — the core (ffmpeg-core.js + the 32 MB wasm) is bundled from npm and served same-origin, so nothing is fetched from a CDN. A live CSS preview lets you place the overlay before any encode runs. On export, an ffmpeg filter_complex scales the second input (the overlay) to a chosen percentage of the main video, snaps both to even dimensions, and overlays it at the selected corner with configurable margins; the result is encoded H.264 + AAC and read back as an MP4 blob. Audio is mapped per the selected mode — keep the main track, the overlay track, mix both with amix, or mute. Single-threaded is deliberate: the multi-threaded core needs SharedArrayBuffer + cross-origin isolation (COOP/COEP), which would block cross-origin ad iframes.
- Runs client-side — neither video is ever uploaded
- Self-hosted ffmpeg core (bundled) — no CDN
- filter_complex: scale overlay to % of main, overlay at chosen corner with margins
- Even-dimension snap; H.264 + AAC encode
- Audio modes: main / overlay / amix / mute
- Live CSS preview before encoding; single-threaded (keeps ads working)
