MagicVideo: Efficient Video Generation With Latent Diffusion Models

Daquan Zhou, Weimin Wang, Hanshu Yan, Weiwei Lv, Yizhe Zhu, Jiashi FengarXiv 2022

Abstract

We present an efficient text-to-video generation framework based on latent diffusion models, termed MagicVideo. MagicVideo can generate smooth video clips that are concordant with the given text descriptions. Due to a novel and efficient 3D U-Net design and modeling video distributions in a low-dimensional space, MagicVideo can synthesize video clips with 256x256 spatial resolution on a single GPU card, which takes around 64x fewer computations than the Video Diffusion Models (VDM) in terms of FLOPs. In specific, unlike existing works that directly train video models in the RGB space, we use a pre-trained VAE to map video clips into a low-dimensional latent space and learn the distribution of videos' latent codes via a diffusion model. Besides, we introduce two new designs to adapt the U-Net denoiser trained on image tasks to video data: a frame-wise lightweight adaptor for the image-to-video distribution adjustment and a directed temporal attention module to capture temporal dependencies across frames. Thus, we can exploit the informative weights of convolution operators from a text-to-image model for accelerating video training. To ameliorate the pixel dithering in the generated videos, we also propose a novel VideoVAE auto-encoder for better RGB reconstruction. We conduct extensive experiments and demonstrate that MagicVideo can generate high-quality video clips with either realistic or imaginary content.

Introduction

Generating video from text is significantly more challenging than generating static images due to three primary hurdles: data scarcity, complex temporal dynamics, and high computational costs. High-quality video-text pairs are much harder to curate than image-text pairs, and ensuring that objects move realistically while maintaining identity across frames is mathematically difficult. Furthermore, most existing diffusion models operate in "pixel space" (RGB), requiring massive amounts of VRAM and processing power. MagicVideo addresses these challenges by moving the diffusion process into a low-dimensional latent space and introducing lightweight architectural modifications to handle temporal consistency efficiently.

Methodology

The core of MagicVideo is the Latent Diffusion Model (LDM). Instead of training a model to generate raw pixels, the framework uses a pre-trained Variational Auto-Encoder (VAE) to compress video frames into a "latent space." The diffusion model then learns to navigate this smaller space, which is significantly faster and computationally cheaper.

Key technical innovations include:

  • 2D + Adaptor Design: Rather than using heavy 3D convolutions, the authors utilize pre-trained 2D convolution weights from image models. They add a lightweight "adaptor"—a small set of learnable scalar parameters—that adjusts the feature distribution for each frame to account for temporal changes.
  • Directed Temporal Attention: To ensure motion consistency, the model uses a causal (directed) self-attention mechanism. This prevents the "future" from leaking into the "past" during generation, leading to more coherent motion.
  • VideoVAE: To combat "pixel dithering" (flickering) common in standard VAEs applied to video, the proposed VideoVAE includes temporal attention layers in the decoder to ensure high-frequency details remain consistent across the sequence.
MagicVideo generates smooth video sequences by modeling temporal dependencies in a latent space, as seen in this cat sequence.

Datasets and Training

The model was trained and evaluated using several large-scale datasets. It was initialized with weights from an LDM trained on LAION-5B. Unsupervised training was conducted on HD-VILA-100M and WebVid-10M, followed by fine-tuning on a self-collected dataset of 7M video-text samples. The system employs a hierarchical pipeline, generating 16 keyframes at 256x256 resolution, followed by frame-interpolation and a super-resolution module to reach a final 1024x1024 output.

Results and Insights

MagicVideo achieves a 64x reduction in FLOPs compared to standard Video Diffusion Models (VDM), making it possible to generate 256x256 videos on a single consumer-grade GPU. Quantitatively, on the UCF-101 dataset, MagicVideo achieved an FID (Fréchet Inception Distance) of 145, significantly outperforming CogVideo (179). Human evaluations via DrawBench showed a preference for MagicVideo in terms of realism, faithfulness to the prompt, and smoothness.

The model can synthesize high-quality imaginary content, such as this Martian landscape, demonstrating its creative versatility.

Key insights from the research include:

  • Prior Knowledge Utilization: By initializing with a pre-trained text-to-image model, MagicVideo inherits a vast understanding of visual concepts, requiring only the "adaptor" strategy to teach the model how to handle temporal deltas.
  • Causality in Attention: Shifting from bi-directional to directed attention was crucial for mimicking the natural flow of time, resulting in more coherent motion.

Limitations and Future Work

While the final output reaches 1024x1024, the core generative process still operates at 256x256, relying heavily on the super-resolution upscaler. Additionally, the model currently focuses on short, 16-frame clips; extending this to long-form video while maintaining consistency remains a challenge. Finally, as the model is trained on large-scale web-scraped data like LAION-5B, it may inherit existing social biases or stereotypes present in those datasets.

Summary updated

BibTeX
@misc{zhou2022magicvideo,
  author = {Daquan Zhou and Weimin Wang and Hanshu Yan and Weiwei Lv and Yizhe Zhu and Jiashi Feng},
  title = {{MagicVideo: Efficient Video Generation With Latent Diffusion Models}},
  year = {2022},
  eprint = {2211.11018},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2211.11018},
}
Figure