Magic Animate Automatic Installer and Video to DensePose Auto Converter For Windows And RunPod (Patreon)
Downloads
Content
Join discord and tell me your discord username to get a special rank : SECourses Discord
Fully automatic installers for Windows using pip and VENV - not even Conda necessary,
This tutorial video made for this video. Watch it to learn how to install Python, Visual C++ tools properly > https://youtu.be/-NjNy7afOQ0
1 January 2024 Update
Full tutorial video published both for Windows & RunPod
CodeFormer Gradio APP improved
Now auto deletes generated frames after video process completed
Just uncheck the option to keep them
Also now can handle space etc character having input video files
Download newest magic_animate_v6.zip
9 December 2023 Update
CodeFormer auto installer and a Gradio web app added to the scripts
Read instructions
Significantly improves Magic Animate made videos face quality
Can also upscale video into 4 times with Real-ESRGAN upscaler
8 December 2023 Update
RunPod installer and instructions added both for DensePose maker and Magic Animate
Now supports custom .safetensors file loading
Default model changed to Realistic_Vision_V6.0_NV_B1.safetensors
You just need to edit magic-animate\configs\prompts\animation.yaml and give model file path
I didn't notice any difference between SD 1.5 and Realistic Vision V6
Pre Requirements
Make sure that you have installed Python 3.10.11 (3.10.x) : https://www.python.org/downloads/release/python-31011/
Installed CUDA Toolkit 11.8 : https://developer.nvidia.com/cuda-11-8-0-download-archive
Installed Git : https://git-scm.com/
Installed FFMPEG and added to the environment path (2:56) : https://youtu.be/OI1LEN-SgLM
https://github.com/BtbN/FFmpeg-Builds/releases/download/latest/ffmpeg-master-latest-win64-gpl.zip
Installed Microsoft Visual Studio C++ Tools 2022 : https://visualstudio.microsoft.com/downloads/
https://aka.ms/vs/17/release/vs_BuildTools.exe
Make sure that your install directories DO NOT HAVE ANY SPACE letters
All above are necessary unfortunately
Current Status
Currently only 512x512 resolution is working. I am trying different resolution solution
You can generate more than 20 seconds videos with 24 GB. If you get out of VRAM error reduce the duration of the input video.
You can try maximum duration according to your GPU
Uncheck --debug
5 December 2023 Huge Update
Please download latest installer zip file from attachments
I have managed to make a very optimized DensePose video generator
When you download and extract files you will get 3 folders
compose_densepose
pre_shared_densepose
compose_magic_animate
compose_dense_pose
Inside compose_densepose first run install_detectron. bat
This file will install all libraries etc into a new VENV for to be able to generate DensePose video from given any raw video
Making this work took me like 15 hours. Make sure that you have followed all Pre Requirements
Then to generate a DensePose of any given raw video first edit make_dense_video. py file
Edit video_path according to your video path
Edit final_output_path according to your desire
You can also edit frames_folder and densepose_output_folder (optional)
Then to generate DensePose video run generate_dense_video. bat file
final_output_path will be DensePose video of given raw video fully automatically with best possible DensePose model
I have written a very special script and edited apply_net. py for batch processing. So this process is blazing fast
Before generating another DensePose video I suggest you to manually delete dense_frames and
compose_magic_animate
Inside compose_magic_animate first run install magic animate. bat
This will generate a new VENV and install everything inside there
It will also download all necessary models automatically for you (huge task)
Making this work took me like 12 hours. Make sure that you have followed all Pre Requirements
After that start Gradio Web APP with run gradio app. bat
It will locally start web APP and open in browser
Then upload your reference image and DensePose video and click generate
You can watch the status from the CMD
The longer the DensePose video it will take longer and it will use more VRAM
The generated videos will be saved into magic-animate\demo\outputs folder
pre_shared_densepose
Inside pre_shared_densepose you will find already prepared DensePose videos that you can directly use with reference images
I also added 2 reference image for my DensePose videos
code_former_improve_face
Inside code_former_improve_face you will find
RunPod / Linux Install Instructions For Magic Animate Gradio install code former. bat and run code former app. bat
To install CodeFormer into its unique venv run install code former. bat file
After that start the myself coded CodeFormer Gradio Web UI with run code former app. bat
With this gradio you can improve faces in given video file significantly and can also upscale video resolution with Real-ESRGAN full automatically
The result videos will be automatically saved inside CodeFormer/results folder
RunPod / Linux Install Instructions For Magic Animate Gradio
https://runpod.io?ref=1aka98lq
If you are a Linux user just change paths from /workspace to your local computer or cloud service path
Select runpod/pytorch (e.g. 2.0.1) template
Edit pod, set volume disk 50 GB
The more VRAM machine you select the longer duration video you can generate
Upload install. sh and downloader. py file from compose_magic_animate folder (inside magic_animate. zip) into your workspace folder
Run below command for install
apt update --yes
cd /workspace
export HF_HOME="/workspace"
chmod +x install.sh
./install.sh
After installation has been complete run with below command
cd /workspace/magic-animate
export HF_HOME="/workspace"
source venv/bin/activate
python -m demo.gradio_animate --share
After that you will get gradio live share
Sadly proxy connect still not working due to Gradio version
The generated video files will be saved inside workspace/magic-animate/demo/outputs by default
RunPod / Linux Install Instructions DensePose Maker
Upload all files inside compose_dense_pose (inside magic_animate. zip) folder except densepose folder into workspace/dense_pose folder. You need to compose dense_pose folder in workspace manually. Enter inside it and upload there as shown in video.
Run below command for install
apt update --yes
apt-get install wget unzip --yes
cd /workspace/dense_pose
export HF_HOME="/workspace"
chmod +x install_detectron.sh
./install_detectron.sh
After installation
Upload your video file into anywhere
Edit make_dense_video. py and set video file and folder paths
Then run make_dense_video. py file as below
apt update line 1 time necessary after each restart
ffmpeg line 1 time necessary after each restart
apt update --yes
apt install ffmpeg --yes
cd /workspace/detectron2
export HF_HOME="/workspace"
source venv/bin/activate
cd ..
cd dense_pose
python make_dense_video.py
Then download generated DensePose video and use from your magic-animate gradio
RunPod / Linux Install Instructions CodeFormer Improve Face
Upload all files inside code_former_improve_face (inside magic_animate. zip) folder into workspace/code_former folder. You need to generate code_former folder manually.
Run below command for install
cd /workspace/code_former
export HF_HOME="/workspace"
chmod +x install_code_former_Runpod.sh
./install_code_former_Runpod.sh
After install run CodeFormer Gradio Web APP as below
update and ffmpeg lines 1 time necessary each time after Pod restart
apt update --yes
apt install ffmpeg --yes
cd /workspace/code_former/CodeFormer
export HF_HOME="/workspace"
source venv/bin/activate
python code_former_app.py --share
To make it work on Linux system just change folder paths
The result videos will be automatically saved inside workspace/CodeFormer/results folder
Extras
Example video : https://www.pexels.com/video/a-man-walking-inside-a-production-plant-3209176/
To auto crop with center
ffmpeg -i input.mp4 -vf "crop=min(iw\,ih):min(iw\,ih), scale=512:512, fps=25" -c:a copy output.mp4
Extract only first second of video to test quicker
ffmpeg -i input.mp4 -t 1 -c copy input_1sec.mp4
Hopefully a full tutorial coming soon
Install inside e.g. G:\magic_animate - do not have any spaces