Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

RTSP communication problem

Hi,

It is my first question in this forum, after looking for a long time any solution. I'm using python 2.7 with OPENCV '2.4.13' (I already tried with 3.1) and I can't open rtsp:// stream. I already solved the ffmpeg problem (dll) and tried to run the local camera and after a local video with success.

could anyone help me? follow below code: PS: Windows 10, x86 rtsp link working (tried in the vlc player) ffmpeg working (tried to run a video in the code locally)

 import cv2
    cap = cv2.VideoCapture('rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov')
    while(True):
        # Capture frame-by-frame
        print("frame")
        ret, frame = cap.read()
        # Display the resulting frame
        print("imshow")
        cv2.imshow('frame',frame)
        print("wait something")
        if cv2.waitKey(1) & 0xFF == ord('q'):
            break

    # When everything done, release the capture
    cap.release()
    cv2.destroyAllWindows()

kind regards, Bruno

RTSP communication problem

Hi,

It is my first question in this forum, after looking for a long time any solution. I'm using python 2.7 with OPENCV '2.4.13' (I already tried with 3.1) and I can't open rtsp:// stream. streams. I already solved the ffmpeg problem (dll) and tried to run the local camera and after a local video with success.

could anyone help me? follow below code: PS: Windows 10, x86 rtsp link working (tried in the vlc player) ffmpeg working (tried to run a video in the code locally)

 import cv2
    cap = cv2.VideoCapture('rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov')
cv2.VideoCapture('http://192.168.0.3:81/videostream.cgi?rate=0&user=admin&pwd=888888')
    while(True):
        # Capture frame-by-frame
        print("frame")
        ret, frame = cap.read()
        # Display the resulting frame
        print("imshow")
        cv2.imshow('frame',frame)
        print("wait something")
        if cv2.waitKey(1) & 0xFF == ord('q'):
            break

    # When everything done, release the capture
    cap.release()
    cv2.destroyAllWindows()

When I try to run I get back

warning: Error opening file (../../modules/highgui/src/cap_ffmpeg_impl.hpp:545)

image of the camera working in the browser image description

kind regards, Bruno

RTSP communication problem

Hi,

It is my first question in this forum, after looking for a long time any solution. I'm using python 2.7 with OPENCV '2.4.13' (I already tried with 3.1) and I can't open streams. I already solved the ffmpeg problem (dll) and tried to run the local camera and after a local video with success.

could anyone help me? follow below code: PS: Windows 10, x86 rtsp link working (tried in the vlc player) ffmpeg working (tried to run a video in the code locally)

 import cv2
    cv2, platform
#import numpy as np

cam = "http://192.168.0.3:81/videostream.cgi?rate=0&user=admin&pwd=888888"
#cam = 0 # Use  local webcam.

cap = cv2.VideoCapture('http://192.168.0.3:81/videostream.cgi?rate=0&user=admin&pwd=888888')
    cv2.VideoCapture(cam)
if not cap:
    print("!!! Failed VideoCapture: invalid parameter!")

while(True):
     # Capture frame-by-frame
        print("frame")
        ret, frame current_frame = cap.read()
    if type(current_frame) == type(None):
        print("!!! Couldn't read frame!")
        break

    # Display the resulting frame
        print("imshow")
        cv2.imshow('frame',frame)
        print("wait something")
    cv2.imshow('frame',current_frame)
    if cv2.waitKey(1) & 0xFF == ord('q'):
         break

    # When everything done, # release the capture
 cap.release()
 cv2.destroyAllWindows()

When I try to run I get back

    C:\Python27\python.exe C:/Users/brleme/PycharmProjects/opencv/main.py
!!! Couldn't read frame!
warning: Error opening file (../../modules/highgui/src/cap_ffmpeg_impl.hpp:545)

image of the camera working in the browser image description

kind regards, Bruno

RTSP communication problem

Hi,

It is my first question in this forum, after looking for a long time any solution. I'm using python 2.7 with OPENCV '2.4.13' (I already tried with 3.1) and I can't open streams. I already solved the ffmpeg problem (dll) and tried to run the local camera and after a local video with success.

could anyone help me? follow below code: PS: Windows 10, x86 rtsp link working (tried in the vlc player) ffmpeg working (tried to run a video in the code locally)

 import cv2, platform
#import numpy as np

cam = "http://192.168.0.3:81/videostream.cgi?rate=0&user=admin&pwd=888888"
"http://192.168.11.146:81/videostream.cgi?rate=0&user=admin&pwd=888888"
#cam = 0 # Use  local webcam.

cap = cv2.VideoCapture(cam)
if not cap:
    print("!!! Failed VideoCapture: invalid parameter!")
cap.isOpened():
    print("not opened")

while(True):
    # Capture frame-by-frame
    ret, current_frame = cap.read()
    if type(current_frame) == type(None):
        print("!!! Couldn't read frame!")
        break

    # Display the resulting frame
    cv2.imshow('frame',current_frame)
    if cv2.waitKey(1) & 0xFF == ord('q'):
        break

# release the capture
cap.release()
cv2.destroyAllWindows()

When I try to run I get back

  C:\Python27\python.exe C:/Users/brleme/PycharmProjects/opencv/main.py
not opened
!!! Couldn't read frame!
warning: Error opening file (../../modules/highgui/src/cap_ffmpeg_impl.hpp:545)

Process finished with exit code 0

image of the camera working in the browser image description

kind regards, Bruno