Capturing RTSP stream fails when the script is turned into a standalone executable using pyinstaller

Deadly 提交于 2019-12-08 06:45:02

问题


Code:

from imutils.video import VideoStream
import cv2

# Read rtsp stream
rtsp = u"rtsp://admin:admin@10.64.1.31:554/1/h264major"
#vs = VideoStream(src=0).start() # for capturing from webcam
vs = VideoStream(src=rtsp).start()

while True:
    frame = vs.read()

    # show the output frame
    cv2.imshow("Frame", frame)
    key = cv2.waitKey(1) & 0xFF

    # if the `q` key was pressed, break from the loop
    if key == ord("q"):
        break

# do a bit of cleanup
cv2.destroyAllWindows()
vs.stop()   
  1. I have faced the same problem when using opencv's VideoCapture [ cap.isOpened() returns False ]
  2. The standalone executable works fine when capturing from webcam in both cases i.e. cv2.VideoCapture(0) or VideoStream(src=0).start()
  3. The rtsp stream capture works fine in both cases when the script is run in python i.e. without turning it into a standalone executable.
  4. The rtsp stream was tested on VLC player and works fine.
  5. I am using Python 3.6.2 | OpenCV 3.2.0 | Windows

Could this be due to utf-8 etc encoding issues of the RTSP link? Any other alternatives?

Solved: Included opencv_ffmpeg320_64.dll next to my executable.


回答1:


Included opencv_ffmpeg320_64.dll next to my executable. Alternatively, copy that dll file to the DLLs folder in python directory



来源:https://stackoverflow.com/questions/47475130/capturing-rtsp-stream-fails-when-the-script-is-turned-into-a-standalone-executab

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!