remove workaround and add actual (maybe working) solution

This commit is contained in:
2026-11-29 17:45:31 -05:00
parent bbfd2ea909
commit 6913ad3691
4 changed files with 26 additions and 9 deletions
+4
View File
@@ -43,6 +43,10 @@ cd Practical-RIFE
pip3 install -r requirements.txt
```
Download a model from the model list and put *.py and flownet.pkl on train_log/
### Video frame reading
Video frames are read with OpenCV (`cv2.VideoCapture`) instead of `skvideo`, and audio is handled with `ffmpeg` directly instead of `moviepy`. Both packages are no longer required, so the old numpy incompatibility (`module 'numpy' has no attribute 'float'`) no longer applies and a newer numpy can be used freely.
### Run
You can use our [demo video](https://drive.google.com/file/d/1i3xlKb7ax7Y70khcTcuePi6E7crO_dFc/view?usp=sharing) or your video.
+10 -3
View File
@@ -7,15 +7,22 @@ from tqdm import tqdm
from torch.nn import functional as F
import warnings
import _thread
import skvideo.io
from queue import Queue, Empty
from model.pytorch_msssim import ssim_matlab
warnings.filterwarnings("ignore")
def video_frames(video_path):
videoCapture = cv2.VideoCapture(video_path)
while True:
ret, frame = videoCapture.read()
if not ret:
break
yield frame
videoCapture.release()
def transferAudio(sourceVideo, targetVideo):
import shutil
import moviepy.editor
tempAudioFileName = "./temp/audio.mkv"
# split audio from original video file and store in "temp" directory
@@ -108,7 +115,7 @@ if not args.video is None:
args.fps = fps * args.multi
else:
fpsNotAssigned = False
videogen = skvideo.io.vreader(args.video)
videogen = video_frames(args.video)
lastframe = next(videogen)
fourcc = cv2.VideoWriter_fourcc('m', 'p', '4', 'v')
video_path_wo_ext, ext = os.path.splitext(args.video)
+10 -3
View File
@@ -7,15 +7,22 @@ from tqdm import tqdm
from torch.nn import functional as F
import warnings
import _thread
import skvideo.io
from queue import Queue, Empty
from model.pytorch_msssim import ssim_matlab
warnings.filterwarnings("ignore")
def video_frames(video_path):
videoCapture = cv2.VideoCapture(video_path)
while True:
ret, frame = videoCapture.read()
if not ret:
break
yield frame
videoCapture.release()
def transferAudio(sourceVideo, targetVideo):
import shutil
import moviepy.editor
tempAudioFileName = "./temp/audio.mkv"
# split audio from original video file and store in "temp" directory
@@ -92,7 +99,7 @@ if not args.video is None:
tot_frame = videoCapture.get(cv2.CAP_PROP_FRAME_COUNT)
videoCapture.release()
fpsNotAssigned = True
videogen = skvideo.io.vreader(args.video)
videogen = video_frames(args.video)
lastframe = next(videogen)
fourcc = cv2.VideoWriter_fourcc('m', 'p', '4', 'v')
video_path_wo_ext, ext = os.path.splitext(args.video)
+2 -3
View File
@@ -1,7 +1,6 @@
numpy>=1.16, <=1.23.5
numpy>=1.16
pillow>=13.0.0
tqdm>=4.35.0
sk-video>=1.1.10
torch>=1.3.0
opencv-python>=4.1.2
moviepy>=1.0.3
torchvision>=0.7.0