How to read video file from sftp location using opencv in python [closed]

asked 2019-04-22 06:59:35 -0600

updated 2019-04-22 08:22:50 -0600

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()
edit retag flag offensive reopen merge delete

Closed for the following reason question is off-topic or not relevant by berak
close date 2019-04-22 12:40:06.971743

Comments

we can't help with 3rd party python libs.

find a way to save the file locally, then use VideoCapture with that

berak gravatar imageberak ( 2019-04-22 12:42:16 -0600 )edit