Streaming Video Diffusion: Online Video Editing with Diffusion Models

Feng Chen, Zhen Yang, Bohan Zhuang, Qi WuOpenReview 2024

TL;DR

This paper introduces "online video editing," a new task focused on editing streaming video frames in real-time while maintaining temporal consistency. They propose SVDiff, a diffusion model that uses a novel "spatial-aware temporal memory" to achieve fast, long-term temporal modeling for zero-shot video editing, reaching 15.2 FPS at 512x512 resolution.

What Problem Does This Paper Address?

Traditional video editing methods (offline editing) assume all video frames are available beforehand, allowing for simultaneous processing. However, many real-world applications like live streaming and online chat require editing video as it arrives (online video editing). This presents several challenges:

  1. Fast Inference: Diffusion models are computationally intensive, making real-time editing difficult due to multi-step denoising.
  2. Long-Term Temporal Modeling: Streaming videos can be very long, requiring the model to understand and maintain consistency over extended periods, which is hard to train for.
  3. Zero-Shot Capability: The model needs to edit any video based on any text prompt without prior specific training for that video.

Existing approaches struggle to balance these requirements, often sacrificing long-term consistency for speed or vice-versa.

Methods

The core of SVDiff is its novel spatial-aware temporal memory. This memory module is integrated into a standard Stable Diffusion architecture. Here's how it works:

  • Spatial-Aware Temporal Memory: This is a learnable embedding that acts as a dynamic cache for temporal information from previous frames. It's designed to capture both the spatial layout of individual frames and the motion trajectories between them. Crucially, it incorporates positional embeddings to maintain spatial awareness, mimicking the structure of frame features.
  • Recurrent Memory Attention: This attention mechanism updates the temporal memory with information from the current frame, allowing it to evolve over time.
  • Segment-Level Training: To handle long videos efficiently during training, the authors divide them into shorter clips. The temporal memory is propagated between these clips, ensuring that historical information is preserved and accessible for subsequent frames. This allows training on videos up to 150 frames long, significantly longer than typical 16-frame training in prior work.
  • Efficient Inference: For faster editing, SVDiff leverages techniques like LCM Inversion and LCM LORA for few-step denoising. It also uses classifier-free guidance (CFG) to balance content fidelity and controllability.

Datasets

The paper mentions training on a "large-scale, long video dataset" and specifically refers to the HDVILA dataset (comprising approximately 2 million subtitled videos) for training. For evaluation, they use a dataset of 66 videos with lengths ranging from 32 to 150 frames, drawn from the TGVE competition and the internet.

Key Insights and Ideas

  • The "Online" Challenge: The paper clearly defines and tackles the distinct challenges of editing video as it streams, which is fundamentally different from offline editing.
  • Memory as a Solution: The introduction of a "spatial-aware temporal memory" is a key innovation. It elegantly addresses the need for long-term temporal modeling without requiring massive computational overhead for every frame. The spatial awareness is crucial for maintaining visual coherence.
  • Segment-Level Training for Scale: Breaking down long videos into manageable segments for training, while still propagating temporal context, is a practical and effective strategy for enabling models to learn from extended sequences.
  • Balancing Act: SVDiff demonstrates a successful balance between computational efficiency (fast inference) and the ability to perform complex, long-term temporal edits.

Key Results

  • Performance: SVDiff achieves a real-time inference speed of 15.2 FPS at a resolution of 512x512.
  • Temporal Consistency: The model shows strong performance in maintaining temporal consistency, outperforming baseline methods. For example, it achieved a 1.53% improvement in temporal consistency over a temporal shift-based method with only a modest increase in GFLOPS.
  • Qualitative Results: The paper showcases impressive qualitative results, demonstrating SVDiff's ability to modify global environments (e.g., grassland to desert), object attributes (e.g., dress to red dress), and styles (e.g., van Gogh style) while preserving temporal coherence in long videos.
  • Parameter Efficiency: The added memory module increases parameters by only 49.7MB, which is comparable to other efficient methods.

Limitations and Future Work

  • Shot Change Detection: The authors acknowledge that their current method might struggle to accurately detect shot changes in very long videos (over 2 minutes) with complex motion or discontinuous backgrounds. This is attributed to the gap between training and inference frame lengths.
  • Future Directions: They plan to investigate strategies to alleviate the influence of the training-inference gap, aiming to efficiently process long videos with complex scene transitions.

Summary updated

BibTeX
@misc{chen2024streaming,
  author = {Feng Chen and Zhen Yang and Bohan Zhuang and Qi Wu},
  title = {{Streaming Video Diffusion: Online Video Editing with Diffusion Models}},
  year = {2024},
  eprint = {2405.19726},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2405.19726},
}
Figure