RoPECraft: Training-Free Motion Transfer with Trajectory-Guided RoPE Optimization on Diffusion Transformers
*Ahmet Berke Gokmen1,2, *Yiğit Ekin1, *Bahri Batuhan Bilecen1,3,4, and Aysegul Dundar1
1Bilkent University, 2INSAIT, Sofia University “St. Kliment Ohridski”, 3ETH Zurich, 4Max Planck Institute
* Equal Contribution
We propose RoPECraft, a training-free video motion transfer method for diffusion transformers that operates solely by modifying their rotary positional embeddings (RoPE). We first extract dense optical flow from a reference video, and utilize the resulting motion offsets to warp the complex-exponential tensors of RoPE, effectively encoding motion into the generation process. These embeddings are then further optimized during denoising time steps via trajectory alignment between the predicted and target velocities using a flow-matching objective. To keep the output faithful to the text prompt and prevent duplicate generations, we incorporate a regularization term based on the phase components of the reference video’s Fourier transform, projecting the phase angles onto a smooth manifold to suppress high-frequency artifacts. Experiments on benchmarks reveal that RoPECraft outperforms all recently published methods, both qualitatively and quantitatively.
The code has been tested using Debian GNU/Linux 13 (trixie) and single NVIDIA H200 gpu.
Recommended CUDA Version: 12.4.1
Recommended GCC Version: 12.4.0
conda create -n ropecraft python=3.11 -y
conda activate ropecraft
pip install torch torchvision --index-url https://download.pytorch.org/whl/cu124
pip install -r requirements.txt
We've mainly utilized DAVIS as our reference motion video dataset. However our method generalizes to any other video. For sample prompts, please refer to our prompts dataset at this link.
We've left some sample videos from DAVIS dataset for you to try our demo.
Simply run the following command on a machine with GPU VRAM > 40GB. It'll automatically download the required checkpoints (only once) from Huggingface.
python generate.py \
--input_video assets/blackswan.mp4 \
--prompt "A child in a duck costume paddles a small inflatable boat across a pond." \
--output_dir output \
--start_with_uv_warped 1 \
--frames 49 \
--num_optim_steps 5 \
--n_replace_gt_mod 10or
python generate.py \
--input_video assets/bus.mp4 \
--prompt "A herd of sheep marches along the street while a shepherd watches from the sidewalk." \
--output_dir output \
--start_with_uv_warped 1 \
--frames 49 \
--num_optim_steps 5 \
--n_replace_gt_mod 10The paper details a new motion transfer metric called Fréchet Trajectory Distance (FTD). You can compute a sample FTD metric from a generated video provided in assets/.
python ftd.py \
--reference_video assets/blackswan.mp4 \
--target_video assets/output/A_child_in_a_duck_co.mp4 \
--mask_path assets/mask/blackswan \
--num_points 100If you found our work useful, please don't forget to cite our work.
@misc{gokmen2025ropecrafttrainingfreemotiontransfer,
title={RoPECraft: Training-Free Motion Transfer with Trajectory-Guided RoPE Optimization on Diffusion Transformers},
author={Ahmet Berke Gokmen and Yigit Ekin and Bahri Batuhan Bilecen and Aysegul Dundar},
year={2025},
eprint={2505.13344},
archivePrefix={arXiv},
primaryClass={cs.CV},
url={https://arxiv.org/abs/2505.13344},
}
Copyright 2025 Bilkent DLR. Licensed under the Apache License, Version 2.0 (the "License").