簡體   English   中英

使用pyinstaller將腳本轉換為獨立可執行文件時,無法捕獲RTSP流

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

碼:

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. 使用opencv的VideoCapture時,我遇到了同樣的問題[cap.isOpened()返回False]
  2. 在兩種情況下(例如cv2.VideoCapture(0)或VideoStream(src = 0).start())從網絡攝像頭捕獲時,獨立可執行文件都可以正常工作
  3. 當腳本在python中運行時,rtsp流捕獲在兩種情況下均能正常工作,即無需將其轉換為獨立的可執行文件。
  4. rtsp流已在VLC播放器上進行了測試,並且工作正常。
  5. 我正在使用Python 3.6.2 | OpenCV 3.2.0 | 視窗

這可能是由於RTSP鏈接的utf-8等編碼問題引起的嗎? 還有其他選擇嗎?

解決 :我的可執行文件旁邊包含opencv_ffmpeg320_64.dll。

我的可執行文件旁邊包含opencv_ffmpeg320_64.dll。 或者,將該dll文件復制到python目錄中的DLLs文件夾中

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM