我在读取视频文件(.mp4格式)时运行一个简单的程序,并在翻转每一帧后写回。我收到错误和错误警告。使用Python在OpenCV3中编写视频时出错
Error in CoreDragRemoveTrackingHandler: -1856
我使用船长巨岩OSX,我已经安装了Python虚拟环境使用Python 3.5的OpenCV 3.2.0-RC。有人可以帮我解决这个问题吗?
由于
import numpy as np
import cv2
cap = cv2.VideoCapture('Root.mp4')
# Define the codec and create VideoWriter object
#fourcc = cv2.VideoWriter_fourcc(*'AVRN')
#out = cv2.VideoWriter('Root1.mp4',fourcc, 20.0, (640,360))
fourcc = cv2.VideoWriter_fourcc(*'MJPG')
out = cv2.VideoWriter('Root1.avi',fourcc, 20.0, (640,360))
while(cap.isOpened()):
ret, frame = cap.read()
if ret==True:
frame = cv2.flip(frame,0)
# write the flipped frame
out.write(frame)
cv2.imshow('frame',frame)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
else:
break
# Release everything if job is finished
cap.release()
out.release()
cv2.destroyAllWindows()
总是放置文本而不是截图 - 现在没有人可以复制粘贴代码来测试它并进行修改。 – furas
好的。谢谢。我会改变它 –
也许问[OpenCV问题](https://github.com/opencv/opencv/issues) – furas