upgrade to moviepy v2

This commit is contained in:
Erfan Asgari 2025-01-11 00:18:24 +03:30 committed by GitHub
parent 8f1829f1cd
commit 70ca65300c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 16 additions and 16 deletions

View File

@ -41,7 +41,7 @@ pip install -r requirements.txt
## Running the code ## Running the code
```bash ```bash
python gradio_web_demo.py python app.py
``` ```

View File

@ -30,7 +30,7 @@ from datetime import datetime, timedelta
from diffusers.image_processor import VaeImageProcessor from diffusers.image_processor import VaeImageProcessor
from openai import OpenAI from openai import OpenAI
import moviepy.editor as mp from moviepy import VideoFileClip
import utils import utils
from rife_model import load_rife_model, rife_inference_with_latents from rife_model import load_rife_model, rife_inference_with_latents
from huggingface_hub import hf_hub_download, snapshot_download from huggingface_hub import hf_hub_download, snapshot_download
@ -271,9 +271,9 @@ def infer(
def convert_to_gif(video_path): def convert_to_gif(video_path):
clip = mp.VideoFileClip(video_path) clip = VideoFileClip(video_path)
clip = clip.set_fps(8) clip = clip.with_fps(8)
clip = clip.resize(height=240) clip = clip.resized(height=240)
gif_path = video_path.replace(".mp4", ".gif") gif_path = video_path.replace(".mp4", ".gif")
clip.write_gif(gif_path, fps=8) clip.write_gif(gif_path, fps=8)
return gif_path return gif_path

View File

@ -15,5 +15,5 @@ gradio>=5.4.0
imageio>=2.34.2 imageio>=2.34.2
imageio-ffmpeg>=0.5.1 imageio-ffmpeg>=0.5.1
openai>=1.45.0 openai>=1.45.0
moviepy>=1.0.3 moviepy>=2.0.0
pillow==9.5.0 pillow==9.5.0

View File

@ -20,7 +20,7 @@ from diffusers import CogVideoXPipeline
from diffusers.utils import export_to_video from diffusers.utils import export_to_video
from datetime import datetime, timedelta from datetime import datetime, timedelta
from openai import OpenAI from openai import OpenAI
import moviepy.editor as mp from moviepy import VideoFileClip
pipe = CogVideoXPipeline.from_pretrained("THUDM/CogVideoX-5b", torch_dtype=torch.bfloat16).to("cuda") pipe = CogVideoXPipeline.from_pretrained("THUDM/CogVideoX-5b", torch_dtype=torch.bfloat16).to("cuda")
@ -117,9 +117,9 @@ def save_video(tensor):
def convert_to_gif(video_path): def convert_to_gif(video_path):
clip = mp.VideoFileClip(video_path) clip = VideoFileClip(video_path)
clip = clip.set_fps(8) clip = clip.with_fps(8)
clip = clip.resize(height=240) clip = clip.resized(height=240)
gif_path = video_path.replace(".mp4", ".gif") gif_path = video_path.replace(".mp4", ".gif")
clip.write_gif(gif_path, fps=8) clip.write_gif(gif_path, fps=8)
return gif_path return gif_path

View File

@ -10,5 +10,5 @@ gradio>=5.5.0
imageio>=2.35.1 imageio>=2.35.1
imageio-ffmpeg>=0.5.1 imageio-ffmpeg>=0.5.1
openai>=1.54.0 openai>=1.54.0
moviepy>=1.0.3 moviepy>=2.0.0
scikit-video>=1.1.11 scikit-video>=1.1.11

View File

@ -12,7 +12,7 @@ from transformers import AutoTokenizer
from datetime import datetime, timedelta from datetime import datetime, timedelta
import threading import threading
import time import time
import moviepy.editor as mp from moviepy import VideoFileClip
torch.set_float32_matmul_precision("high") torch.set_float32_matmul_precision("high")
@ -140,9 +140,9 @@ def save_video(tensor):
def convert_to_gif(video_path): def convert_to_gif(video_path):
clip = mp.VideoFileClip(video_path) clip = VideoFileClip(video_path)
clip = clip.set_fps(8) clip = clip.with_fps(8)
clip = clip.resize(height=240) clip = clip.resized(height=240)
gif_path = video_path.replace(".mp4", ".gif") gif_path = video_path.replace(".mp4", ".gif")
clip.write_gif(gif_path, fps=8) clip.write_gif(gif_path, fps=8)
return gif_path return gif_path

View File

@ -26,7 +26,7 @@ build:
- imageio>=2.35.1 - imageio>=2.35.1
- imageio-ffmpeg>=0.5.1 - imageio-ffmpeg>=0.5.1
- openai>=1.45.0 - openai>=1.45.0
- moviepy>=1.0.3 - moviepy>=2.0.0
- pillow==9.5.0 - pillow==9.5.0
- pydantic==1.10.7 - pydantic==1.10.7
run: run: