Merge pull request #652 from erfanasgari21/moviepy-v2

Update code and requirements to support Moviepy v2
This commit is contained in:
Yuxuan Zhang 2025-01-21 22:29:15 +08:00 committed by GitHub
commit ea994c75c2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 17 additions and 17 deletions

View File

@ -41,7 +41,7 @@ pip install -r requirements.txt
## Running the code
```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 openai import OpenAI
import moviepy.editor as mp
from moviepy import VideoFileClip
import utils
from rife_model import load_rife_model, rife_inference_with_latents
from huggingface_hub import hf_hub_download, snapshot_download
@ -271,9 +271,9 @@ def infer(
def convert_to_gif(video_path):
clip = mp.VideoFileClip(video_path)
clip = clip.set_fps(8)
clip = clip.resize(height=240)
clip = VideoFileClip(video_path)
clip = clip.with_fps(8)
clip = clip.resized(height=240)
gif_path = video_path.replace(".mp4", ".gif")
clip.write_gif(gif_path, fps=8)
return gif_path

View File

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

View File

@ -20,7 +20,7 @@ from diffusers import CogVideoXPipeline
from diffusers.utils import export_to_video
from datetime import datetime, timedelta
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")
@ -117,9 +117,9 @@ def save_video(tensor):
def convert_to_gif(video_path):
clip = mp.VideoFileClip(video_path)
clip = clip.set_fps(8)
clip = clip.resize(height=240)
clip = VideoFileClip(video_path)
clip = clip.with_fps(8)
clip = clip.resized(height=240)
gif_path = video_path.replace(".mp4", ".gif")
clip.write_gif(gif_path, fps=8)
return gif_path

View File

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

View File

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

View File

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