How to read video file from sftp location using opencv in python [closed]
I am facing issue in reading file from sftp location using opencv lib. Can you tell me how to read file from sftp location or sftp file object. If can you tell me read large file directly to opencv lib then it's good things.
import paramiko
import cv2
import numpy as np
client = paramiko.SSHClient()
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
client.connect("IPADDRESS", port=22, username='USERNAME', password='PASSWORD')
t = client.get_transport()
sftp = paramiko.SFTPClient.from_transport(t)
sftp.chdir("/home/bizviz/devanshu_copy")
obj = sftp.open("SampleVideo_1280x720_1mb.mp4")
cap = cv2.VideoCapture.open(obj)
while True:
_,frame = cap.read()
print(frame)
cv2.imshow('res', frame)
key = cv2.waitKey(1)
if key == 27:
break
cap.release()
cv2.destroyAllWindows()
we can't help with 3rd party python libs.
find a way to save the file locally, then use VideoCapture with that