PAI-Studio: Cinematic Video Background Replacement with Camera-Aware Motion

Heyuan Gao, Bangxun Tang, Yiren Song, Guian Fang, Zijian He, Jie Yang, Mike Zheng ShouarXiv 2026

TL;DR

PAI-Studio introduces a novel framework for cinematic video background replacement that generates dynamic, camera-aware backgrounds from sparse reference images. By reformulating the problem as an in-context conditional generation task using a Diffusion Transformer, it simultaneously achieves realistic foreground relighting, identity preservation, and robustness to imperfect masks.

What Problem Does This Paper Address?

Traditional video background replacement relies heavily on green-screen chroma keying or precise matting tools. However, when a camera moves (e.g., panning, dollying, or tracking shots), static background inserts look fake and disconnected. Existing video-to-video editing models and commercial APIs frequently suffer from three major flaws:

  1. Motion Inconsistency: Backgrounds appear static or drift unnaturally relative to the foreground camera movement.
  2. Illumination Mismatch: Foreground subjects retain their original lighting, causing a jarring visual detachment from the new background environment.
  3. Boundary Artifacts: Real-world masks are rarely pixel-perfect; flickering edges, holes, and "green spill" (residual green borders) easily ruin the composition.

PAI-Studio tackles these challenges simultaneously by treating background replacement not as a local inpainting or compositing task, but as a global, multi-condition video synthesis problem.

Methods

Instead of stacking complex, cascaded modules (like separate matting networks or relighting adapters), PAI-Studio uses an elegant, unified architecture built on a Diffusion Transformer (DiT) backbone (specifically, WAN 2.2-5B).

Overview of the PAI-Studio architecture showing multi-condition token concatenation and bidirectional attention.

Key technical innovations include:

  • In-Context Conditional Generation: The model concatenates text prompts, foreground video tokens, background reference image tokens, and noisy output tokens into a single sequence. It then applies full bidirectional self-attention, allowing the network to globally reason over all conditions and modalities at once.
  • Temporal Positional Encoding Cloning: To handle large camera movements where the background changes significantly over time, the framework supports multi-frame background control (using 1–3 reference images). It explicitly maps these images to specific target frames by cloning the temporal positional encodings of the denoising tokens at those time indices.
  • Illumination Perturbation Training: To force the model to actually relight the subject rather than just copy the input video's illumination, the authors intentionally corrupt the color, contrast, and color temperature of the input foreground during training. The model is then forced to reconstruct the original, clean foreground appearance using cues from the target background.

Datasets

To train and evaluate this framework under realistic conditions, the authors introduced two new resources:

  • CineStudio Dataset: A 30K-scale dataset reverse-engineered from real-world user challenges. Sourced from high-quality films and online videos, the pipeline uses shot segmentation and optical flow filtering to ensure significant camera and background motion. Foreground subjects are extracted using advanced segmentation models (SAM3), intentionally leaving behind realistic mask imperfections like boundary flickering and holes.
Overview of the CineStudio data construction pipeline.
  • Cine-Benchmark: A rigorous evaluation benchmark split into two subsets:
  • Cine-Restore Subset (150 videos): Uses clean background plates extracted from the original video to evaluate exact reconstruction fidelity against a ground truth.
  • Cine-NBG (Novel Background Generation) Subset (50 videos): Uses AI-generated, out-of-distribution background styles to test generalization in entirely new environments.

Key Insights and Ideas

  • Global Generation Heals Boundaries: By generating the entire video globally rather than inpainting the background locally, the model naturally "hallucinates" missing foreground details and smooths out jagged mask boundaries. It performs joint background synthesis and semantic foreground inpainting seamlessly.
  • Breaking Illumination Correspondence is Essential: Naive training allows models to cheat by preserving the input foreground's lighting. Intentionally applying severe photometric perturbations during training forces the network to learn zero-shot, scene-adaptive relighting from background environmental cues.
  • Positional Encoding Cloning Anchors Content: Simply copying positional encodings acts as a powerful, lightweight mechanism to anchor background reference images to specific timestamps, preventing background drift and object morphing during large camera movements.
Ablation study results demonstrating the impact of position encoding control, illumination adaptation, and structured annotations.

Key Results

PAI-Studio was evaluated against open-source baselines (VACE) and top-tier commercial APIs (including Kling O1, Kling 3.0 Omni, Runway Gen-4 Aleph, and Beeble AI Switchx).

  • Quantitative Performance: On the Cine-Restore multi-frame benchmark, PAI-Studio achieved an MSE of 0.00645 and an SSIM of 0.789, significantly outperforming the closest commercial competitor, Kling O1 (MSE: 0.0190, SSIM: 0.682).
  • Perceptual Metrics: Evaluated via Gemini-3-Pro automated judging and human user studies, PAI-Studio consistently led across all dimensions: Motion Consistency, Edge Quality, Foreground Preservation, Foreground-Background Fusion, and Illumination Harmony. In the user study, it secured a decisive win rate exceeding 56% against all baselines.

Limitations and Future Work

Despite its impressive visual fidelity, PAI-Studio faces a few notable constraints:

  • High Computational Cost: Symmetrical full-resolution processing at 1080p is slow. Generating a 4-second (97 frames) video with 50 denoising steps takes roughly 25 minutes and consumes ~100 GB of VRAM on an NVIDIA H200 GPU. The authors plan to explore progressive distillation techniques to compress the model into a faster, few-step (e.g., 4-step) generation framework.
  • Complex Physical Optics: The model struggles with view-dependent optical effects, such as strong light transmission or refraction when a camera moves across transparent boundaries like glass tables.
  • Abrupt Transitions: Drastic, discontinuous scene changes can still result in unrealistic background details due to a lack of temporal semantic continuity.

Summary updated

BibTeX
@misc{gao2026pai,
  author = {Heyuan Gao and Bangxun Tang and Yiren Song and Guian Fang and Zijian He and Jie Yang and Mike Zheng Shou},
  title = {{PAI-Studio: Cinematic Video Background Replacement with Camera-Aware Motion}},
  year = {2026},
  eprint = {2606.01399},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2606.01399},
}
Figure