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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
datasets:
|
| 3 |
+
- QingyanBai/Ditto-1M
|
| 4 |
+
base_model:
|
| 5 |
+
- Wan-AI/Wan2.1-T2V-1.3B
|
| 6 |
+
---
|
| 7 |
+
<div align="center">
|
| 8 |
+
|
| 9 |
+
<h1>LiveEdit</h1>
|
| 10 |
+
<h2>Towards Real-Time Diffusion-Based Streaming Video Editing</h2>
|
| 11 |
+
|
| 12 |
+
Xinyu Wang<sup>1</sup>, Chongbo Zhao<sup>1</sup>, Fangneng Zhan<sup>2</sup>, Yue Ma<sup>2</sup>
|
| 13 |
+
|
| 14 |
+
<sup>1</sup>THU <sup>2</sup>HKUST
|
| 15 |
+
|
| 16 |
+
<strong>Accepted by ECCV 2026</strong>
|
| 17 |
+
|
| 18 |
+
<a href='https://arxiv.org/abs/2606.26740'><img src='https://img.shields.io/badge/ArXiv-2606.26740-red'></a>
|
| 19 |
+
<a href="https://live-edit.github.io"><img src="https://img.shields.io/badge/Project-Page-green"></a>
|
| 20 |
+
<a href="https://huggingface.co/cp-cp/LiveEdit/tree/main"><img src="https://img.shields.io/badge/HuggingFace-Checkpoints-yellow"></a>
|
| 21 |
+
<img src="https://img.shields.io/badge/Task-Streaming%20Video%20Editing-blue">
|
| 22 |
+
<img src="https://img.shields.io/badge/Base-Wan2.1-purple">
|
| 23 |
+
|
| 24 |
+
</div>
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
## π£ Updates
|
| 28 |
+
|
| 29 |
+
- **[2026.06.24]** Release README, inference scripts, and Hugging Face checkpoint instructions.
|
| 30 |
+
- **[2026.06.24]** Release inference and training code.
|
| 31 |
+
|
| 32 |
+
## π Overview
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
LiveEdit is a diffusion-based framework for streaming video editing. Given a source video and a text editing instruction, LiveEdit performs causal chunk-by-chunk editing while preserving backgrounds and non-edited regions.
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
## β¨ Highlights
|
| 39 |
+
|
| 40 |
+
- Real-time-oriented video editing with causal chunk-by-chunk inference.
|
| 41 |
+
- Strong source preservation for backgrounds and non-edited regions.
|
| 42 |
+
- Three-stage distillation from a bidirectional editing teacher to a streaming student.
|
| 43 |
+
- AR-oriented Mask Cache for efficient region-aware computation reuse.
|
| 44 |
+
- Built on Wan2.1 and the Self-Forcing codebase.
|
| 45 |
+
|
| 46 |
+
## π Getting Started
|
| 47 |
+
|
| 48 |
+
### 1. Clone the code and prepare the environment
|
| 49 |
+
|
| 50 |
+
We recommend Linux with NVIDIA GPUs. Single-GPU inference is supported; training scripts are written for multi-GPU `torchrun`.
|
| 51 |
+
|
| 52 |
+
```bash
|
| 53 |
+
conda create -n liveedit python=3.10 -y
|
| 54 |
+
conda activate liveedit
|
| 55 |
+
pip install -r requirements.txt
|
| 56 |
+
pip install flash-attn --no-build-isolation
|
| 57 |
+
```
|
| 58 |
+
|
| 59 |
+
### 2. Download pretrained weights
|
| 60 |
+
|
| 61 |
+
Download the Wan2.1 base model:
|
| 62 |
+
|
| 63 |
+
```bash
|
| 64 |
+
huggingface-cli download Wan-AI/Wan2.1-T2V-1.3B \
|
| 65 |
+
--local-dir-use-symlinks False \
|
| 66 |
+
--local-dir wan_models/Wan2.1-T2V-1.3B
|
| 67 |
+
```
|
| 68 |
+
|
| 69 |
+
Download the released LiveEdit checkpoint:
|
| 70 |
+
|
| 71 |
+
```bash
|
| 72 |
+
mkdir -p checkpoints/liveedit
|
| 73 |
+
huggingface-cli download cp-cp/LiveEdit ar-forcing_002000.pt \
|
| 74 |
+
--local-dir checkpoints/liveedit
|
| 75 |
+
```
|
| 76 |
+
|
| 77 |
+
The released checkpoint should be organized as:
|
| 78 |
+
|
| 79 |
+
```text
|
| 80 |
+
checkpoints/
|
| 81 |
+
βββ liveedit/
|
| 82 |
+
βββ ar-forcing_002000.pt
|
| 83 |
+
|
| 84 |
+
wan_models/
|
| 85 |
+
βββ Wan2.1-T2V-1.3B/
|
| 86 |
+
```
|
| 87 |
+
|
| 88 |
+
`ar-forcing_002000.pt` corresponds to the 2000-step self-forcing checkpoint used by `infer-local-ar-forcing.sh`.
|
| 89 |
+
|
| 90 |
+
### 3. Prepare input videos
|
| 91 |
+
|
| 92 |
+
For video-to-video editing, prepare a JSON file with source videos and text instructions:
|
| 93 |
+
|
| 94 |
+
```json
|
| 95 |
+
[
|
| 96 |
+
{
|
| 97 |
+
"instruction": "Change the red currants to deep black grapes.",
|
| 98 |
+
"source_path": "./test_cases/test.mp4"
|
| 99 |
+
}
|
| 100 |
+
]
|
| 101 |
+
```
|
| 102 |
+
|
| 103 |
+
Example inputs are provided in `test_cases/test.json` and `test_cases/test-long.json`.
|
| 104 |
+
|
| 105 |
+
### 4. Inference
|
| 106 |
+
|
| 107 |
+
Run the default LiveEdit inference script:
|
| 108 |
+
|
| 109 |
+
```bash
|
| 110 |
+
bash infer-local-ar-forcing.sh
|
| 111 |
+
```
|
| 112 |
+
|
| 113 |
+
Equivalent command:
|
| 114 |
+
|
| 115 |
+
```bash
|
| 116 |
+
CUDA_VISIBLE_DEVICES=0 python inference-mm.py \
|
| 117 |
+
--config_path configs/wan_mm-ar-forcing-local.yaml \
|
| 118 |
+
--output_folder videos/test \
|
| 119 |
+
--checkpoint_path checkpoints/liveedit/ar-forcing_002000.pt \
|
| 120 |
+
--data_path test_cases/test.json \
|
| 121 |
+
--num_output_frames 21 \
|
| 122 |
+
--task v2v \
|
| 123 |
+
--inference_num_steps 50
|
| 124 |
+
```
|
| 125 |
+
|
| 126 |
+
## π Efficient Inference with AR-Oriented Mask Cache
|
| 127 |
+
|
| 128 |
+
The AR-oriented Mask Cache in the paper is exposed through the token-pruning inference config and helper script. It reuses computation in unchanged regions and can optionally save mask visualizations.
|
| 129 |
+
|
| 130 |
+
```bash
|
| 131 |
+
bash infer-token-pruning.sh
|
| 132 |
+
```
|
| 133 |
+
|
| 134 |
+
Equivalent command:
|
| 135 |
+
|
| 136 |
+
```bash
|
| 137 |
+
CUDA_VISIBLE_DEVICES=0 python inference-mm.py \
|
| 138 |
+
--config_path configs/wan_mm-token-pruning.yaml \
|
| 139 |
+
--output_folder videos/mask-cache-test \
|
| 140 |
+
--checkpoint_path checkpoints/liveedit/ar-forcing_002000.pt \
|
| 141 |
+
--data_path test_cases/test.json \
|
| 142 |
+
--num_output_frames 21 \
|
| 143 |
+
--prefix "mask_cache_" \
|
| 144 |
+
--task v2v \
|
| 145 |
+
--save_mask
|
| 146 |
+
```
|
| 147 |
+
|
| 148 |
+
`--save_mask` saves visualizations of the reused and fully computed regions to the output folder.
|
| 149 |
+
|
| 150 |
+
## βοΈ Training
|
| 151 |
+
|
| 152 |
+
LiveEdit uses a three-stage training pipeline:
|
| 153 |
+
|
| 154 |
+
1. **Foundation Tuning for Editing Ability Acquisition**: trains a strong offline video editing model.
|
| 155 |
+
2. **Teacher Forcing for Chunk-wise Causal Initial**: adapts the model to causal chunk-wise editing.
|
| 156 |
+
3. **DMD for Streaming Video Editing**: compresses streaming inference to a small number of denoising steps.
|
| 157 |
+
|
| 158 |
+
Example entry points:
|
| 159 |
+
|
| 160 |
+
```bash
|
| 161 |
+
bash train-mm-bid-diffusion.sh
|
| 162 |
+
bash train-mm-ar-diffusion.sh
|
| 163 |
+
bash train-mm-ar-forcing.sh
|
| 164 |
+
```
|
| 165 |
+
|
| 166 |
+
Before training, update the config paths for your dataset, Wan2.1 model location, and stage checkpoints.
|
| 167 |
+
|
| 168 |
+
|
| 169 |
+
## π Acknowledgements
|
| 170 |
+
|
| 171 |
+
This repository builds on [Self-Forcing](https://github.com/guandeh17/Self-Forcing), [CausVid](https://github.com/tianweiy/CausVid), and [Wan2.1](https://github.com/Wan-Video/Wan2.1). We thank the authors for their open-source contributions.
|
| 172 |
+
|
| 173 |
+
|
| 174 |
+
## Citation π
|
| 175 |
+
|
| 176 |
+
If you find this project useful for your research, please cite:
|
| 177 |
+
|
| 178 |
+
```bibtex
|
| 179 |
+
@inproceedings{wang2026liveedit,
|
| 180 |
+
title={LiveEdit: Towards Real-Time Diffusion-Based Streaming Video Editing},
|
| 181 |
+
author={Wang, Xinyu and Zhao, Chongbo and Zhan, Fangneng and Ma, Yue},
|
| 182 |
+
booktitle={European Conference on Computer Vision},
|
| 183 |
+
year={2026}
|
| 184 |
+
organization={Springer}
|
| 185 |
+
}
|
| 186 |
+
```
|