OpenCv videoCapture http Connection url return to tcp://direction:port failed: Connection refused

Viewed 109

videoCapture() with an url of a stream in loop at a remote server. When I start the remote server where I host the script I receive Connection to tcp://direction:port failed: Connection refused

I tried to install ffmpeg but didn't work

import cv2 
import imutils
from imutils.video import FPS

vs = cv2.VideoCapture("http://channel.sitedir.com:port/channels/Barcelona720p.m3u8")
fps = FPS().start()
while True:
     ret, frame = vs.read()
     frame = imutils.resize(frame, width=400)

     cv2.imshow("Output",frame)
     key = cv2.waitKey(1) & 0xFF
     if key == ord("q"):
         break
     fps.update() 

fps.stop()
print("elapsed time: {:.2f}".format(fps.elapsed()))
print("approx. FPS: {:.2f}".format(fps.fps()))

cv2.destroyAllWindows()

When I run this script locally (Windows 10) works fine, and even when I use a youtube url instead with pafy and youtube-dl I can process the video on the server (Ubuntu 18.04.4 LTS). How can I solve this problem?

0 Answers
Related