首页 > 解决方案 > How to use cv2.VideoCapture() to open a live video stream from a different computer's camera remotely?

问题描述

I can correctly open a live video stream from my computer's camera that I'm running my python code on. I want to continue running my code on this same computer. How can I open up a video capture from this computer that shows the camera stream of my other computer. I don't want to run the code on my other computer, but want to view the live video stream of the other computer on my current computer. I would appreciate any help on this!

vid = cv2.VideoCapture(0) #0 gets the computer i'm running on's camera. how can i remotely access my other computer's camera?
 
while(True):
     
    # Capture the video frame by frame
    ret, frame = vid.read()
 
    # Display the resulting frame
    cv2.imshow(frame)
     
    # the 'q' button is set as the quitting button
    if cv2.waitKey(1) & 0xFF == ord('q'):
        break
 
# After the loop release the cap object
vid.release()
# Destroy all the windows
cv2.destroyAllWindows()

标签: pythonopencvvideo-streaming

解决方案


除非您的计算机上有允许您这样做的程序,否则您无法捕获另一台计算机的相机。例如,您进入受害者计算机的恶意程序。


推荐阅读