Introduction
AI-driven video editing has advanced significantly, yet most tools remain limited to global stylistic changes. Localized edits, such as inserting a specific object into a scene, present unique challenges in blending and temporal coherence. The object must match the background's lighting and texture while remaining consistent across frames without flickering.
InVi is a framework designed for seamless object insertion and replacement in videos using standard, "off-the-shelf" text-to-image diffusion models. By employing a recursive "inpaint and match" strategy with modified attention layers, InVi achieves high temporal consistency and realistic blending without the need for expensive video-specific training or per-video fine-tuning.
Methodology
The InVi pipeline leverages Latent Diffusion Models (LDMs) and ControlNet through a two-step process:
1. Single-Frame Inpainting
The process begins by inserting the target object into the initial frame. A ControlNet-based inpainting model ensures the object adheres to a specific control signal (such as a skeletal pose or depth map) and aligns with the provided text prompt.
2. Recursive Propagation with Extended Attention
To maintain consistency across subsequent frames, InVi uses the previously inpainted frame as an "anchor." The standard self-attention layers in the diffusion model are replaced with extended-attention layers. In these layers, features from the anchor frame serve as the "keys" and "values," forcing the current frame to maintain visual consistency with its predecessor.
Additionally, DDIM inversion is applied to the background to ensure noise patterns remain stable, preventing background warping. To mitigate "halo" artifacts—flickering squares often caused by VAE reconstruction—a post-processing step uses Grounding-DINO and SAM for precise masking, followed by the Lama inpainting tool for smooth edge blending.
Experimental Evaluation
The researchers evaluated InVi across several datasets, including DAVIS (video object segmentation), VIRAT (surveillance), and various human-centric YouTube videos. A custom test set of 30 text-video pairs was also used, featuring scenarios like inserting cars or basketballs into "cleaned" backgrounds (processed via RunwayML).
Results and Insights
InVi demonstrates that high-quality image models possess sufficient spatial knowledge for video editing; the primary challenge is managing attention across the temporal dimension. The recursive approach (where frame $i$ anchors frame $i+1$) allows the model to adapt to gradual changes in lighting and pose more effectively than a global anchor.
Quantitative and Qualitative Performance
InVi significantly outperforms baselines such as TokenFlow and Tune-a-Video:
- Background Consistency: InVi improved background consistency scores (Back-L1) by over 40 points compared to methods prone to "color leakage."
- User Preference: In a study with 15 participants, InVi was preferred in approximately 75% of cases regarding text alignment, temporal consistency, and overall visual quality.
- Visual Fidelity: Qualitative results show sharp details and static backgrounds, avoiding the blurriness common in competing methods.
Conclusion
InVi provides a robust solution for local video editing by repurposing existing image diffusion models. While currently dependent on 2D bounding boxes for object placement, future work may involve automating layout generation using Large Language Models to further streamline the creative process.
Summary updated