AdaFlow: Efficient Long Video Editing via Adaptive Attention Slimming And Keyframe Selection
February 12, 2025 ยท View on GitHub
AdaFlow is a training-free method for efficient long video editing, leveraging adaptive attention slimming and keyframe selection to handle over 1k frames in a single GPU inference while maintaining high quality and temporal consistency, validated on the novel LongV-EVAL benchmark.
Overview

Sample Results

Environment
conda env create -f environment.yml
Preprocess
Preprocess you video by running using the following command:
python preprocess.py --data_path <data/myvideo.mp4>
Additional arguments:
--save_dir <latents>
--H <video height>
--W <video width>
--sd_version <Stable-Diffusion version>
--steps <number of inversion steps>
--save_steps <number of sampling steps that will be used later for editing>
--n_frames <number of frames>
Editing
To edit your video, first create a yaml config as yaml files in configs. Then run
python run.py --config_path <yaml config file path>
LongV-EVAL
LongV-EVAL is a benchmark designed for evaluating text-driven long video editing methods, featuring 75 high-quality videos (~1 minute each) spanning diverse scenes (humans, landscapes, animals, etc.) with three annotated editing prompts per video (foreground, background, style). It includes metrics for frame quality, video quality, object consistency, and semantic consistency to comprehensively assess editing performance.
Please visit LongV-EVAL on Hugging Face at the following link: https://huggingface.co/datasets/zhangsh2001/LongV-EVAL.
Citation
@misc{zhang2025adaflowefficientlongvideo,
title={AdaFlow: Efficient Long Video Editing via Adaptive Attention Slimming And Keyframe Selection},
author={Shuheng Zhang and Yuqi Liu and Hongbo Zhou and Jun Peng and Yiyi Zhou and Xiaoshuai Sun and Rongrong Ji},
year={2025},
eprint={2502.05433},
archivePrefix={arXiv},
primaryClass={cs.CV},
url={https://arxiv.org/abs/2502.05433},
}
Acknowledgment
We would like to acknowledge that part of our code is derived from the open-source project TokenFlow. Thanks for their amazing work!