使用imageio.ffmpeg.download()时发生弃用错误 [英] Deprecation error when using imageio.ffmpeg.download()
本文介绍了使用imageio.ffmpeg.download()时发生弃用错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用python Opencv合并预录的视频. 但是我在导入时遇到了错误.
I'm trying to merge the prerecorded videos using python Opencv. But i'm getting the error while importing.
"Traceback (most recent call last):
File "video.py", line 4, in <module>
from moviepy. editor import VideoFileClip,concatenate_videoclips
File "/home/pi/.virtualenvs/cv/lib/python3.5/site-packages/moviepy/editor.py", line 26, in <module>
imageio.plugins.ffmpeg.download()
File "/home/pi/.virtualenvs/cv/lib/python3.5/site-packages/imageio/plugins/ffmpeg.py", line 40, in download
"imageio.ffmpeg.download() has been deprecated. "
RuntimeError: imageio.ffmpeg.download() has been deprecated. Use 'pip install imageio-ffmpeg' instead.'"
有人请帮助摆脱这个问题
would anyone please help to get out of this problem
这是代码:
import cv2
import os
import time
from moviepy.editor import VideoFileClip,concatenate_videoclips
def vidcapt():
a = time.strftime("%H,%M,%S")
cap = cv2.VideoCapture(0)
fourcc = cv2.VideoWriter_fourcc(*'XVID')
out = cv2.VideoWriter(a+'.avi', fourcc, 24.0, (640,480))
t1 = time.time()
while(cap.isOpened()):
ret, frame = cap.read()
if ret == True:
out.write(frame)
cv2.imshow('frame',frame)
t2 = time.time()
time_diff = t2-t1
if time_diff >= 5:
break
else:
break
cap.release()
out.release()
cv2.destroyAllWindows()
while True:
vidcapt()
clip1 = VideoFileClip("11,05,42.avi")
clip2 = VideoFileClip("11,05,47.avi").subclip(50,60)
final_clip = concatenate_videoclips([clip1,clip2])
final_clip.write_videofile("merged.avi")
推荐答案
请尝试以下操作:
sudo pip3 install imageio==2.4.1
希望能解决您的问题.
这篇关于使用imageio.ffmpeg.download()时发生弃用错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文